<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements.  See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership.  The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>streams-contrib</artifactId>
        <groupId>org.apache.streams</groupId>
        <version>0.3-incubating</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>streams-persist-elasticsearch</artifactId>
    <name>${project.artifactId}</name>

    <description>Elasticsearch Module</description>

    <properties>
        <elasticsearch.version>1.1.0</elasticsearch.version>
        <lucene.version>4.7.2</lucene.version>
    </properties>

    <dependencies>
        <!-- Test includes -->
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-test-framework</artifactId>
            <version>${lucene.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-codecs</artifactId>
            <version>${lucene.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <type>test-jar</type>
            <scope>test</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-config</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-pojo</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-pojo-extensions</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-util</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-pojo</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <scope>compile</scope>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${orgjson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.streams</groupId>
            <artifactId>streams-testing</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <type>test-jar</type>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
                <version>${elasticsearch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.elasticsearch</groupId>
                <artifactId>elasticsearch</artifactId>
                <type>test-jar</type>
                <version>${elasticsearch.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-test-framework</artifactId>
                <version>${lucene.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.lucene</groupId>
                <artifactId>lucene-codecs</artifactId>
                <version>${lucene.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>${clean.plugin.version}</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/site/resources</directory>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                        <!-- this is here because elasticsearch integration tests don't have a setting to change directory where temp index files get created -->
                        <fileset>
                            <directory>data</directory>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <includes>**/*.json</includes>
                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                    <includeGroupIds>org.apache.streams</includeGroupIds>
                    <includeArtifactIds>streams-pojo</includeArtifactIds>
                    <includeTypes>test-jar</includeTypes>
                </configuration>
                <executions>
                    <execution>
                        <id>test-resource-dependencies</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources/jsonschema2pojo</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jsonschema2pojo</groupId>
                <artifactId>jsonschema2pojo-maven-plugin</artifactId>
                <configuration>
                    <addCompileSourceRoot>true</addCompileSourceRoot>
                    <generateBuilders>true</generateBuilders>
                    <sourcePaths>
                        <sourcePath>${project.basedir}/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchConfiguration.json</sourcePath>
                        <sourcePath>${project.basedir}/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchReaderConfiguration.json</sourcePath>
                        <sourcePath>${project.basedir}/src/main/jsonschema/org/apache/streams/elasticsearch/ElasticsearchWriterConfiguration.json</sourcePath>
                    </sourcePaths>
                    <outputDirectory>target/generated-sources/jsonschema2pojo</outputDirectory>
                    <targetPackage>org.apache.streams.elasticsearch.pojo</targetPackage>
                    <useLongIntegers>true</useLongIntegers>
                    <useJodaDates>true</useJodaDates>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
