<?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>
  <!-- Parent -->
  <parent>
    <groupId>io.stargate</groupId>
    <artifactId>stargate</artifactId>
    <version>2.0.21</version>
  </parent>
  <!-- Artifact properties -->
  <groupId>io.stargate.db.dse</groupId>
  <artifactId>persistence-dse-6.8</artifactId>
  <name>Stargate - Coordinator - Persistence DSE 6.8</name>
  <properties>
    <dse.version>6.8.38</dse.version>
  </properties>
  <repositories>
    <repository>
      <id>central</id>
      <url>https://repo.maven.apache.org/maven2</url>
    </repository>
    <repository>
      <id>artifactory-snapshots</id>
      <url>https://repo.datastax.com/datastax-snapshots-local</url>
    </repository>
    <repository>
      <id>artifactory-releases</id>
      <url>https://repo.datastax.com/datastax-releases-local</url>
    </repository>
  </repositories>
  <dependencyManagement>
    <dependencies>
      <!-- DSE version beginning 6.8.30 depends on guava 31+ -->
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>32.0.1-jre</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <!-- Stargate component dependencies -->
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-test</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-api</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-handler</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.stargate.core</groupId>
      <artifactId>core</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.stargate.auth</groupId>
      <artifactId>authnz</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <!-- Cassandra/DataStax -->
    <dependency>
      <groupId>com.datastax.dse</groupId>
      <artifactId>dse-core</artifactId>
      <version>${dse.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.gridkit.jvmtool</groupId>
          <artifactId>sjk-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.cryptsoft</groupId>
          <artifactId>kmip</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.jetty.aggregate</groupId>
          <artifactId>jetty-all</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.datastax.logging</groupId>
          <artifactId>cassandra-log4j-appender</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.datastax.oss</groupId>
          <artifactId>java-driver-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>dnsjava</groupId>
          <artifactId>dnsjava</artifactId>
        </exclusion>
        <!-- See https://github.com/stargate/stargate/issues/1200 -->
        <exclusion>
          <groupId>com.azure</groupId>
          <artifactId>azure-storage-blob</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.datastax.dse</groupId>
      <artifactId>dse-commons</artifactId>
      <version>${dse.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.gridkit.jvmtool</groupId>
          <artifactId>sjk-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.azure</groupId>
          <artifactId>azure-storage-blob</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.datastax.oss</groupId>
      <artifactId>java-driver-shaded-guava</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-codec</artifactId>
      <version>4.1.86.1.dse</version>
    </dependency>
    <!-- 3rd party dependencies -->
    <dependency>
      <groupId>org.immutables</groupId>
      <artifactId>value</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.gridkit.jvmtool</groupId>
      <artifactId>sjk-core</artifactId>
      <version>0.14</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>dnsjava</groupId>
      <artifactId>dnsjava</artifactId>
      <version>2.1.8</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-graphite</artifactId>
    </dependency>
    <dependency>
      <groupId>com.github.akarnokd</groupId>
      <artifactId>rxjava2-extensions</artifactId>
      <version>0.20.10</version>
    </dependency>
    <dependency>
      <groupId>org.javatuples</groupId>
      <artifactId>javatuples</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <exclusions>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
      </exclusions>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <parallel>suites</parallel>
          <threadCountSuites>1</threadCountSuites>
          <reuseForks>false</reuseForks>
          <forkCount>1</forkCount>
          <systemPropertyVariables>
            <ccm.dse>true</ccm.dse>
            <ccm.version>${dse.version}</ccm.version>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-sjk</id>
            <phase>compile</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.gridkit.jvmtool</groupId>
                  <artifactId>sjk-core</artifactId>
                  <version>0.14</version>
                  <outputDirectory>${project.build.directory}/sjk-core</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
            <id>unpack-dnsjava</id>
            <phase>compile</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>dnsjava</groupId>
                  <artifactId>dnsjava</artifactId>
                  <version>2.1.8</version>
                  <outputDirectory>${project.build.directory}/dnsjava</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>fix-sjk-core</id>
            <phase>process-classes</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- Remove root package classes -->
                <delete>
                  <fileset dir="${project.build.directory}/sjk-core/" includes="*.class"/>
                </delete>
                <jar destfile="${project.build.directory}/classes/sjk-core-0.14.jar">
                  <fileset dir="${project.build.directory}/sjk-core"/>
                </jar>
                <delete dir="${project.build.directory}/sjk-core"/>
              </tasks>
            </configuration>
          </execution>
          <execution>
            <id>fix-dnsjava</id>
            <phase>process-classes</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <!-- Remove root package classes -->
                <delete>
                  <fileset dir="${project.build.directory}/dnsjava/" includes="*.class"/>
                </delete>
                <jar destfile="${project.build.directory}/classes/dnsjava-2.1.8.jar">
                  <fileset dir="${project.build.directory}/dnsjava"/>
                </jar>
                <delete dir="${project.build.directory}/dnsjava"/>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <unpackBundle>true</unpackBundle>
          <instructions>
            <Bundle-Name>DSE-Persistence</Bundle-Name>
            <Bundle-Description>DSE DB component for project</Bundle-Description>
            <Bundle-SymbolicName>io.stargate.db.dse</Bundle-SymbolicName>
            <Bundle-Activator>io.stargate.db.dse.DsePersistenceActivator</Bundle-Activator>
            <Import-Package><![CDATA[
              org.slf4j,
              org.slf4j.helpers,
              org.slf4j.spi,
              ch.qos.logback.classic,
              ch.qos.logback.classic.helpers,
              ch.qos.logback.classic.spi,
              ch.qos.logback.core,
              ch.qos.logback.core.helpers,
              ch.qos.logback.core.spi,
              org.osgi.framework,
              io.stargate.core.*,
              io.stargate.auth.*,
              io.stargate.db,
              io.stargate.db.*,
              org.apache.cassandra.stargate,
              org.apache.cassandra.stargate.*,
              org.javatuples,
              !com.codahale.metrics.graphite.*,
              com.codahale.metrics,
              com.datastax.oss.driver.shaded.guava.common.*,
            ]]></Import-Package>
            <Export-Package>!*</Export-Package>
            <Bundle-ClassPath>.,sjk-core-0.14.jar,dnsjava-2.1.8.jar,{maven-dependencies}</Bundle-ClassPath>
            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
          </instructions>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
          <outputDirectory>${project.basedir}/../stargate-lib</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>it-dse-6.8</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>dse-6.8</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
