<!--
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT 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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <name>Azure Cosmos Extensions for Apache Cassandra</name>
  <description>
    Extends the DataStax Java Driver 4 and Spring Data for Apache Cassandra client libraries with Azure Cosmos DB awareness features.
  </description>
  <url>https://docs.microsoft.com/en-us/azure/cosmos-db/cassandra-introduction</url>

  <artifactId>azure-cosmos-cassandra-driver-4</artifactId>
  <groupId>com.azure</groupId>
  <packaging>pom</packaging>
  <version>1.1.2</version>

  <developers>
    <developer>
      <name>Azure Cosmos Cassandra API developers</name>
      <email>azuredocumentdb@service.microsoft.com</email>
      <organization>Microsoft Azure</organization>
      <organizationUrl>
        https://azure.microsoft.com/en-us/blog/dear-cassandra-developers-welcome-to-azure-cosmosdb/
      </organizationUrl>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
    </license>
  </licenses>

  <modules>
    <module>driver-4</module>
    <module>spring-data</module>
    <module>examples/java-driver-app</module>
    <module>examples/spring-boot-app</module>
  </modules>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <javadoc.options/>
    <!-- Package dependency version numbers -->
    <version.cassandra-driver>[4.7,4.14)</version.cassandra-driver>
    <version.jackson>[2.12,2.13)</version.jackson>
    <version.slf4j-api>[1.7,1.8.0-alpha0)</version.slf4j-api>
    <version.spring-data-cassandra>[3.2,3.3)</version.spring-data-cassandra>
    <!-- Examples dependency version numbers -->
    <version.spring-boot-starter-data-cassandra>[2.4.4]</version.spring-boot-starter-data-cassandra>
    <!-- Test dependency version numbers -->
    <version.assertj-core>3.18.0</version.assertj-core>
    <version.junit-jupiter>5.7.1</version.junit-jupiter>
    <version.log4j>[2.17.0,)</version.log4j>
    <version.testng>7.3.0</version.testng>
  </properties>

  <scm>
    <developerConnection>scm:git:git@github.com:Azure/azure-cosmos-cassandra-extensions.git</developerConnection>
    <connection>scm:git:git@github.com:Azure/azure-cosmos-cassandra-extensions.git</connection>
    <url>scm:git:https://github.com/Azure/azure-cosmos-cassandra-extensions</url>
    <tag>HEAD</tag>
  </scm>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-cosmos-cassandra-driver-4-extensions</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-cosmos-cassandra-spring-data-extensions</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>com.datastax.oss</groupId>
        <artifactId>java-driver-core</artifactId>
        <version>${version.cassandra-driver}</version>
      </dependency>
      <dependency>
        <groupId>com.datastax.oss</groupId>
        <artifactId>java-driver-metrics-micrometer</artifactId>
        <version>${version.cassandra-driver}</version>
      </dependency>
      <dependency>
        <groupId>com.datastax.oss</groupId>
        <artifactId>java-driver-query-builder</artifactId>
        <version>${version.cassandra-driver}</version>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jdk8</artifactId>
        <version>${version.jackson}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-core</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-slf4j-impl</artifactId>
        <version>${version.log4j}</version>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>${version.assertj-core}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-api</artifactId>
        <version>${version.junit-jupiter}</version>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter-params</artifactId>
        <version>${version.junit-jupiter}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${version.slf4j-api}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-cassandra</artifactId>
        <version>${version.spring-boot-starter-data-cassandra}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-cassandra</artifactId>
        <version>${version.spring-data-cassandra}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.3.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-checkstyle-plugin</artifactId>
          <version>3.1.2</version>
          <dependencies>
            <dependency>
              <groupId>com.puppycrawl.tools</groupId>
              <artifactId>checkstyle</artifactId>
              <version>8.42</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.1.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.0.0-M1</version>
        </plugin>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.1.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>
        <plugin>
          <groupId>com.github.spotbugs</groupId>
          <artifactId>spotbugs-maven-plugin</artifactId>
          <version>4.2.3</version>
        </plugin>
        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>2.4.5</version>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <configLocation>azure-cosmos-style.xml</configLocation>
          <propertyExpansion>samedir=${project.basedir}</propertyExpansion>
          <consoleOutput>true</consoleOutput>
          <failsOnError>true</failsOnError>
          <linkXRef>false</linkXRef>
        </configuration>
        <executions>
          <execution>
            <id>validate</id>
            <phase>validate</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
          <docfilessubdirs>false</docfilessubdirs>
          <doclint>all,-html</doclint>
          <quiet>true</quiet>
          <verbose>false</verbose>
          <sourceFileExcludes>
            <sourceFileExclude>**/implementation/**/*.java</sourceFileExclude>
          </sourceFileExcludes>
        </configuration>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <propertiesEncoding>UTF-8</propertiesEncoding>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <useModulePath>false</useModulePath>
          <systemPropertyVariables>
            <javax.net.ssl.trustStoreType>JKS</javax.net.ssl.trustStoreType>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <configuration>
          <spotbugsXmlOutputDirectory>${project.build.directory}/spotbugs</spotbugsXmlOutputDirectory>
          <effort>max</effort>
          <failOnError>true</failOnError>
          <fork>true</fork>
          <includeTests>true</includeTests>
          <threshold>Low</threshold>
          <xmlOutput>true</xmlOutput>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

  <profiles>
    <!-- Setup for Java 8, excludes module-info.java -->
    <profile>
      <id>java-8</id>
      <activation>
        <jdk>[1.8,9)</jdk>
      </activation>
      <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
      </properties>
      <build>
        <plugins>
          <!-- Don't compile module-info.java -->
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
              <excludes>
                <exclude>module-info.java</exclude>
              </excludes>
            </configuration>
          </plugin>
          <!-- Don't document module-info.java -->
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <sourceFileExcludes>
                <sourceFileExclude>module-info.java</sourceFileExclude>
              </sourceFileExcludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <plugins>
          <!-- Don't document module-info.java -->
          <plugin>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <sourceFileExcludes>
                <sourceFileExclude>module-info.java</sourceFileExclude>
              </sourceFileExcludes>
            </configuration>
          </plugin>
        </plugins>
      </reporting>
    </profile>
    <!-- Setup for Java LTS+, currently JDK 11 and up -->
    <profile>
      <id>java-lts</id>
      <activation>
        <jdk>[11,)</jdk>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <source>11</source>
              <target>11</target>
            </configuration>
            <executions>
              <!-- Compile first with module-info for Java LTS+ -->
              <execution>
                <id>default-compile</id>
                <configuration>
                  <release>11</release>
                </configuration>
              </execution>
              <!-- Compile next without module-info for Java 8 -->
              <execution>
                <id>base-compile</id>
                <goals>
                  <goal>compile</goal>
                </goals>
                <configuration>
                  <release>8</release>
                  <excludes>
                    <exclude>module-info.java</exclude>
                  </excludes>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <reportSets>
          <reportSet>
            <reports>
              <report>checkstyle</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

</project>
