<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.microsoft.azure</groupId>
    <artifactId>spring-data-cosmosdb</artifactId>
    <version>2.2.2</version>

    <name>Spring Data for Azure Cosmos DB SQL API</name>
    <description>Spring Data for Azure Cosmos DB SQL API</description>
    <url>https://github.com/Microsoft/spring-data-cosmosdb</url>

    <licenses>
        <license>
            <name>MIT</name>
            <url>https://github.com/Microsoft/spring-data-cosmosdb/blob/master/LICENSE</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>yungez</id>
            <name>Yunge Zhu</name>
            <email>yungez@microsoft.com</email>
        </developer>
    </developers>

    <organization>
        <name>Microsoft</name>
        <url>https://www.microsoft.com</url>
    </organization>

    <scm>
        <connection>scm:git:git://github.com/Microsoft/spring-data-cosmosdb.git</connection>
        <developerConnection>scm:git:ssh://github.com:Microsoft/spring-data-cosmosdb.git
        </developerConnection>
        <url>https://github.com/Microsoft/spring-data-cosmosdb/tree/master</url>
    </scm>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>MM-dd-HH-mm-ss</maven.build.timestamp.format>

        <spring.springframework.version>5.2.0.RELEASE</spring.springframework.version>
        <spring.data.version>2.2.0.RELEASE</spring.data.version>
        <fasterxml.jackson.version>2.10.0</fasterxml.jackson.version>

        <mockito.core.version>2.8.9</mockito.core.version>
        <powermock.version>1.7.1</powermock.version>
        <spring.boot.starter.test.version>2.2.0.RELEASE</spring.boot.starter.test.version>
        <org.projectlombok.version>1.16.18</org.projectlombok.version>
        <java.tuples.version>1.2</java.tuples.version>
        <slf4j.version>1.7.25</slf4j.version>
        <gson.version>2.8.4</gson.version>
        <project.reactor.test.version>3.3.0.RELEASE</project.reactor.test.version>

        <azure.cosmos.version>3.6.0</azure.cosmos.version>
        <azure.test.resourcegroup>spring-data-cosmosdb-test</azure.test.resourcegroup>
        <azure.test.dbname>testdb-${maven.build.timestamp}</azure.test.dbname>
        <skip.integration.tests>true</skip.integration.tests>
        <test.on.azure>false</test.on.azure>
        <test.on.emualator>false</test.on.emualator>
    </properties>

    <repositories>
        <repository>
            <id>spring-milestone</id>
            <name>Spring Milestones</name>
            <url>http://repo.spring.io/libs-milestone</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>${spring.data.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>com.microsoft.azure</groupId>
            <artifactId>azure-cosmos</artifactId>
            <version>${azure.cosmos.version}</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-parameter-names</artifactId>
            <version>${fasterxml.jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jdk8</artifactId>
            <version>${fasterxml.jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${fasterxml.jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20140107</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${org.projectlombok.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.javatuples</groupId>
            <artifactId>javatuples</artifactId>
            <version>${java.tuples.version}</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.core.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito2</artifactId>
            <version>${powermock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring.boot.starter.test.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <version>${project.reactor.test.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>META-INF/project.properties</include>
                    <include>telemetry.config</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <configuration>
                    <show>private</show>
                    <failOnError>false</failOnError>
                    <sourceFileExcludes>
                        <exclude>
                            com/microsoft/azure/spring/data/cosmosdb/documentdb/core/mapping/BasicCosmosPersistentProperty.java
                        </exclude>
                    </sourceFileExcludes>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <additionalparam>${javadoc.opts}</additionalparam>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>${project.basedir}/config/checkstyle.xml</configLocation>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <failOnViolation>true</failOnViolation>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <linkXRef>false</linkXRef>
                </configuration>
                <inherited>true</inherited>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>show-profiles</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>active-profiles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.5</version>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Low</threshold>
                    <xmlOutput>true</xmlOutput>
                    <findbugsXmlOutputDirectory>${project.build.directory}/findbugs
                    </findbugsXmlOutputDirectory>
                    <excludeFilterFile>${project.basedir}/config/findbugs-exclude.xml</excludeFilterFile>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.ant</groupId>
                        <artifactId>ant</artifactId>
                        <version>1.9.4</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
                    <check>
                        <haltOnFailure>true</haltOnFailure>
                        <branchRate>65</branchRate>
                        <totalBranchRate>65</totalBranchRate>
                    </check>
                    <instrumentation>
                        <excludes>
                            <exclude>com/microsoft/azure/**/GetHashMac.class</exclude>
                            <exclude>com/microsoft/azure/**/Constants.class</exclude>
                        </excludes>
                    </instrumentation>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.19</version>
                <configuration>
                    <systemPropertiesFile>src/test/resources/application.properties</systemPropertiesFile>
                    <skipITs>${skip.integration.tests}</skipITs>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <id>setup</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target if="${test.on.azure}">
                                <ant antfile="build.xml" target="setup">
                                </ant>
                            </target>
                        </configuration>
                    </execution>

                    <execution>
                        <id>cleanup</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target if="${test.on.azure}">
                                <ant antfile="build.xml" target="cleanup"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <build.profile.id>dev</build.profile.id>
                <skip.integration.tests>true</skip.integration.tests>
                <test.on.azure>false</test.on.azure>
                <test.on.emulator>false</test.on.emulator>
            </properties>
        </profile>
        <profile>
            <id>integration-test-azure</id>
            <properties>
                <build.profile.id>integration-test-azure</build.profile.id>
                <skip.integration.tests>false</skip.integration.tests>
                <test.on.azure>true</test.on.azure>
                <test.on.emulator>false</test.on.emulator>
            </properties>
        </profile>
        <profile>
            <id>travis-ci-test</id>
            <properties>
                <build.profile.id>travis-ci-test</build.profile.id>
                <skip.integration.tests>false</skip.integration.tests>
                <test.on.azure>true</test.on.azure>
                <test.on.emulator>false</test.on.emulator>
            </properties>
        </profile>
        <profile>
            <id>performance-test</id>
            <properties>
                <build.profile.id>performance-test</build.profile.id>
                <skip.integration.tests>false</skip.integration.tests>
                <test.on.azure>false</test.on.azure>
                <test.on.emulator>false</test.on.emulator>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>PerformanceCompare.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>integration-test-emulator</id>
            <properties>
                <build.profile.id>integration-test-emulator</build.profile.id>
                <skip.integration.tests>false</skip.integration.tests>
                <test.on.azure>false</test.on.azure>
                <test.on.emulator>true</test.on.emulator>
            </properties>
            <build>
              <plugins>
                <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <configuration>
                    <excludes>
                      <!--Excluding PageablePersonRepositoryIT test class, as it creates large documents which are not suitable for emulator-->
                      <exclude>**/PageablePersonRepositoryIT.java</exclude>
                    </excludes>
                  </configuration>
                </plugin>
              </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
        </profile>
        <profile>
            <id>doclint-java8-disable</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <javadoc.opts>-Xdoclint:none</javadoc.opts>
            </properties>
        </profile>
    </profiles>
</project>
