<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>fr.pilato.spring</groupId>
    <artifactId>spring-elasticsearch</artifactId>
    <packaging>jar</packaging>
    <name>spring-elasticsearch</name>
    <version>6.2</version>
    <url>https://github.com/dadoonet/spring-elasticsearch</url>
    <description>Spring factories for Elasticsearch</description>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.compiler.version>1.8</java.compiler.version>

        <spring.version>5.1.3.RELEASE</spring.version>
        <elasticsearch.version>6.5.3</elasticsearch.version>
        <elasticsearch.rest.version>${elasticsearch.version}</elasticsearch.rest.version>
        <beyonder.version>6.5</beyonder.version>
        <slf4j.version>1.7.25</slf4j.version>
        <log4j.version>2.11.0</log4j.version>
        <commons.io.version>2.6</commons.io.version>
        <jackson.version>2.9.8</jackson.version>
        <junit.version>5.3.0-M1</junit.version>

        <skipTests>false</skipTests>
        <skip.unit.tests>${skipTests}</skip.unit.tests>
        <skip.integration.tests>${skipTests}</skip.integration.tests>
        <tests.cluster.credentials>elastic:changeme</tests.cluster.credentials>
    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <developers>
        <developer>
            <id>dadoonet</id>
            <name>David Pilato</name>
            <email>david@pilato.fr</email>
            <url>http://david.pilato.fr/</url>
            <timezone>+1</timezone>
        </developer>
        <developer>
            <id>nhuray</id>
            <name>Nicolas Huray</name>
            <url>https://github.com/nhuray/</url>
            <timezone>+1</timezone>
        </developer>
        <developer>
            <id>nlabrot</id>
            <name>Nicolas Labrot</name>
            <url>https://github.com/nithril‎/</url>
            <timezone>Europe/Paris</timezone>
        </developer>
    </developers>

    <scm>
        <url>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</url>
        <connection>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</connection>
        <developerConnection>scm:git:git@github.com:dadoonet/spring-elasticsearch.git</developerConnection>
      <tag>spring-elasticsearch-6.2</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/dadoonet/spring-elasticsearch/issues/</url>
    </issueManagement>

    <repositories>
        <!-- This repository is used to test with x-pack -->
        <repository>
            <id>elastic-download-service</id>
            <name>Elastic Download Service</name>
            <url>https://artifacts.elastic.co/maven/</url>
            <releases><enabled>true</enabled></releases>
            <snapshots><enabled>false</enabled></snapshots>
        </repository>

        <repository>
            <id>elastic-snapshots</id>
            <name>Elastic Snapshots</name>
            <url>http://snapshots.elastic.co/maven/</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>

        <repository>
            <id>oss-snapshots</id>
            <name>Sonatype OSS Snapshots</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <releases><enabled>false</enabled></releases>
            <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <!-- Logging dependencies -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <!-- LOG4J2 implementation is optional -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-1.2-api</artifactId>
            <version>${log4j.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.version}</version>
            <optional>true</optional>
        </dependency>

        <!-- add the transport client jar as an optional dependency -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>transport</artifactId>
            <version>${elasticsearch.version}</version>
            <optional>true</optional>
        </dependency>
        <!-- add the x-pack jar as an optional dependency -->
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>x-pack-transport</artifactId>
            <version>${elasticsearch.version}</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.elasticsearch.client</groupId>
            <artifactId>elasticsearch-rest-high-level-client</artifactId>
            <version>${elasticsearch.rest.version}</version>
        </dependency>
        <dependency>
            <groupId>fr.pilato.elasticsearch</groupId>
            <artifactId>elasticsearch-beyonder</artifactId>
            <version>${beyonder.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons.io.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <version>${spring.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>3.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>${java.compiler.version}</source>
                    <target>${java.compiler.version}</target>
                    <encoding>UTF-8</encoding>
                    <optimize>true</optimize>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <compilerArgument>-Xlint:all,-serial,-path,-rawtypes,-unchecked</compilerArgument>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.0.0-M2</version>
                <configuration>
                    <rules>
                        <requireJavaVersion>
                            <version>${java.compiler.version}</version>
                        </requireJavaVersion>
                    </rules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.8</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>sonatype-nexus-staging</serverId>
                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-scm-plugin</artifactId>
                <version>1.11.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-changes-plugin</artifactId>
                <version>2.12.1</version>
                <configuration>
                    <smtpHost>auth.smtp.1and1.fr</smtpHost>
                    <smtpPort implementation="java.lang.Integer">465</smtpPort>
                    <sslMode>true</sslMode>
                    <fromDeveloperId>dadoonet</fromDeveloperId>
                    <toAddresses>
                        <toAddress implementation="java.lang.String">discuss+community-plugins@elastic.co</toAddress>
                    </toAddresses>
                    <issueManagementSystems>
                        <issueManagementSystem>GitHub</issueManagementSystem>
                    </issueManagementSystems>
                    <issueTypes>
                        <add>new,doc</add>
                        <fix>bug</fix>
                        <update>update</update>
                        <remove>remove</remove>
                    </issueTypes>
                    <onlyCurrentVersion>true</onlyCurrentVersion>
                    <urlDownload>
                        https://repo1.maven.org/maven2/fr/pilato/spring/spring-elasticsearch/${project.version}/
                    </urlDownload>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <pushChanges>false</pushChanges>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.alexcojocaru</groupId>
                <artifactId>elasticsearch-maven-plugin</artifactId>
                <version>6.9</version>
                <configuration>
                    <flavor>oss</flavor>
                    <version>${elasticsearch.version}</version>
                    <skip>${skip.integration.tests}</skip>
                    <clusterName>elasticsearch</clusterName>
                </configuration>
                <executions>
                    <!--
                        The elasticsearch maven plugin goals are by default bound to the
                        pre-integration-test and post-integration-test phases
                    -->
                    <execution>
                        <id>start-elasticsearch</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>runforked</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-elasticsearch</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <!-- Skips unit tests if the value of skip.unit.tests property is true -->
                    <skipTests>${skip.unit.tests}</skipTests>
                    <!-- Excludes integration tests when unit tests are run -->
                    <excludes>
                        <exclude>**/it/**/*Test.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.0.0-M3</version>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.platform</groupId>
                        <artifactId>junit-platform-surefire-provider</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                </dependencies>
                <executions>
                    <!--
                        Invokes both the integration-test and the verify goals of the
                        Failsafe Maven plugin
                    -->
                    <execution>
                        <id>integration-tests</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                        <configuration>
                            <!--
                                Skips integration tests if the value of skip.integration.tests
                                property is true
                            -->
                            <skipTests>${skip.integration.tests}</skipTests>
                            <!-- Excludes integration tests when unit tests are run -->
                            <includes>
                                <include>**/it/**/*Test.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
    </build>

    <profiles>
        <profile>
            <id>x-pack</id>
            <build>
                <plugins>
                    <!-- We disable the elasticsearch-maven-plugin as it can not run with x-pack yet -->
                    <!-- https://github.com/alexcojocaru/elasticsearch-maven-plugin/issues/42 -->
                    <plugin>
                        <groupId>com.github.alexcojocaru</groupId>
                        <artifactId>elasticsearch-maven-plugin</artifactId>
                        <version>6.9</version>
                        <configuration>
                            <flavor>default</flavor>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
