<?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.datastax.astra</groupId>
    <artifactId>astra-db-java-parent</artifactId>
    <name>AstraDB Java SDK</name>
    <version>2.0.0-PREVIEW3</version>
    <packaging>pom</packaging>
    <url>https://github.com/datastax/astra-db-java</url>
    <inceptionYear>2024</inceptionYear>
    <description>Implementation of a client to the Astra/Stargate Data API written in Java</description>

    <modules>
        <module>astra-db-java</module>
        <module>astra-db-java-tools</module>
        <module>examples</module>
        <module>langchain4j-astradb</module>
        <module>astra-sdk-devops</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- Third Party Libraries -->
        <devops-sdk.version>1.2.9</devops-sdk.version>
        <slf4j.version>2.0.17</slf4j.version>
        <logback.version>1.5.18</logback.version>
        <jackson.version>2.18.3</jackson.version>
        <lombok.version>1.18.38</lombok.version>
        <retry4j.version>0.15.0</retry4j.version>
        <awaitility.version>4.2.2</awaitility.version>
        <mockwebserver.version>4.12.0</mockwebserver.version>
        <uuid-generator.version>5.1.0</uuid-generator.version>
        <httpclient.version>5.3</httpclient.version>

        <!-- Test -->
        <test.skipped>true</test.skipped>
        <assertj.version>3.26.3</assertj.version>
        <junit-jupiter.version>5.12.1</junit-jupiter.version>

        <!-- Maven -->
        <required-maven.version>3.6.3</required-maven.version>
        <maven.plugin.compiler.source>17</maven.plugin.compiler.source>
        <maven.plugin.compiler.target>17</maven.plugin.compiler.target>
        <version.maven.plugin.compiler>3.13.0</version.maven.plugin.compiler>
        <version.maven.plugin.coveralls>4.3.0</version.maven.plugin.coveralls>
        <version.maven.plugin.dependency>3.8.0</version.maven.plugin.dependency>
        <version.maven.plugin.enforcer>3.5.0</version.maven.plugin.enforcer>
        <version.maven.plugin.gpg>3.2.6</version.maven.plugin.gpg>
        <version.maven.plugin.jacoco>0.8.12</version.maven.plugin.jacoco>
        <version.maven.plugin.javadoc>3.10.0</version.maven.plugin.javadoc>
        <version.maven.plugin.jar>3.4.2</version.maven.plugin.jar>
        <version.maven.plugin.license>2.5.0</version.maven.plugin.license>
        <version.maven.plugin.nexus>1.7.0</version.maven.plugin.nexus>
        <version.maven.plugin.release>3.1.1</version.maven.plugin.release>
        <version.maven.plugin.resources>3.3.1</version.maven.plugin.resources>
        <version.maven.plugin.source>3.3.1</version.maven.plugin.source>
        <version.maven.plugin.surefire>3.5.1</version.maven.plugin.surefire>
        <version.maven.plugin.central>0.7.0</version.maven.plugin.central>
    </properties>

    <dependencyManagement>
        <dependencies>

            <!-- BOM needs to be in dependencyManagement section to work -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>

            <!--  Http Client 5-->
            <dependency>
                <groupId>org.apache.httpcomponents.client5</groupId>
                <artifactId>httpclient5</artifactId>
                <version>${httpclient.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.httpcomponents.client5</groupId>
                <artifactId>httpclient5-fluent</artifactId>
                <version>${httpclient.version}</version>
            </dependency>

            <!-- UUID Generation -->
            <dependency>
                <groupId>com.fasterxml.uuid</groupId>
                <artifactId>java-uuid-generator</artifactId>
                <version>${uuid-generator.version}</version>
            </dependency>

            <!-- Core -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>com.evanlennick</groupId>
                <artifactId>retry4j</artifactId>
                <version>${retry4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>

            <!-- TEST -->
            <dependency>
                <groupId>org.junit.jupiter</groupId>
                <artifactId>junit-jupiter-engine</artifactId>
                <version>${junit-jupiter.version}</version>
            </dependency>
            <dependency>
                <groupId>org.assertj</groupId>
                <artifactId>assertj-core</artifactId>
                <version>${assertj.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.okhttp3</groupId>
                <artifactId>mockwebserver</artifactId>
                <version>${mockwebserver.version}</version>
            </dependency>
            <dependency>
                <groupId>org.awaitility</groupId>
                <artifactId>awaitility</artifactId>
                <version>${awaitility.version}</version>
            </dependency>

        </dependencies>

    </dependencyManagement>

    <!-- Client is JDK11+ -->
    <build>
        <plugins>

<!-- Moving to publishing to central -->
<!--            <plugin>-->
<!--                <groupId>org.sonatype.plugins</groupId>-->
<!--                <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!--                <version>${version.maven.plugin.nexus}</version>-->
<!--                <extensions>true</extensions>-->
<!--                <configuration>-->
<!--                    <serverId>ossrh</serverId>-->
<!--                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
<!--                    <autoReleaseAfterClose>false</autoReleaseAfterClose>-->
<!--                    <skipLocalStaging>true</skipLocalStaging>-->
<!--                </configuration>-->
<!--            </plugin>-->

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${version.maven.plugin.central}</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${version.maven.plugin.gpg}</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${version.maven.plugin.source}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>${version.maven.plugin.release}</version>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${version.maven.plugin.compiler}</version>
                <configuration>
                    <source>${maven.plugin.compiler.source}</source>
                    <target>${maven.plugin.compiler.target}</target>
                    <showWarnings>false</showWarnings>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${version.maven.plugin.enforcer}</version>
                <executions>
                    <execution>
                        <id>enforce-maven</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>${required-maven.version}</version>
                                </requireMavenVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.maven.plugin.surefire}</version>
                <configuration>
                    <skipTests>${test.skipped}</skipTests>
                    <systemPropertyVariables>
                        <ASTRA_DB_JAVA_TEST_ENV>${ASTRA_DB_JAVA_TEST_ENV}</ASTRA_DB_JAVA_TEST_ENV>
                        <ASTRA_CLOUD_PROVIDER_DEV>${ASTRA_CLOUD_PROVIDER_DEV}</ASTRA_CLOUD_PROVIDER_DEV>
                        <ASTRA_CLOUD_REGION_DEV>${ASTRA_CLOUD_REGION_DEV}</ASTRA_CLOUD_REGION_DEV>
                    </systemPropertyVariables>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.junit.jupiter</groupId>
                        <artifactId>junit-jupiter-engine</artifactId>
                        <version>${junit-jupiter.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${version.maven.plugin.javadoc}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>${maven.plugin.compiler.source}</source>
                    <overview>${basedir}/src/main/java/overview.html</overview>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.maven.plugin.jacoco}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-prepare-agent-integration</id>
                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report-integration</id>
                        <goals>
                            <goal>report-integration</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${version.maven.plugin.dependency}</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${version.maven.plugin.jar}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>empty</classifier>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                    <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                </manifest>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>${version.maven.plugin.resources}</version>
                <configuration>
                    <escapeString>\</escapeString>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>central</id>
            <url>https://central.sonatype.com</url>
        </repository>
    </distributionManagement>

    <scm>
        <connection>scm:git:git@github.com:datastax/astra-db-java.git</connection>
        <developerConnection>scm:git:git@github.com:datastax/astra-db-java.git</developerConnection>
        <url>https://github.com/datastax/astra-db-java</url>
        <tag>1.4.6</tag>
    </scm>

    <developers>
        <developer>
            <id>clunven</id>
            <name>Cedrick Lunven</name>
            <email>cedrick.lunven@gmail.com</email>
            <url>https://github.com/clun</url>
        </developer>
        <developer>
            <id>msmygit</id>
            <name>Madhavan Sridharan</name>
            <email>madhavan_5k@yahoo.com</email>
            <url>https://github.com/msmygit</url>
        </developer>
    </developers>

    <profiles>

       <profile>
         <id>release</id>
         <activation>
         <activeByDefault>false</activeByDefault>
        </activation>
       </profile>


        <profile>
            <id>test_local</id>
            <properties>
                <ASTRA_DB_JAVA_TEST_ENV>local</ASTRA_DB_JAVA_TEST_ENV>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>com/datastax/astra/test/integration/**/*.**Test.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>test_astra_dev</id>
            <properties>
                <ASTRA_DB_JAVA_TEST_ENV>astra_dev</ASTRA_DB_JAVA_TEST_ENV>
                <ASTRA_CLOUD_PROVIDER>GCP</ASTRA_CLOUD_PROVIDER>
                <ASTRA_CLOUD_REGION>us-central1</ASTRA_CLOUD_REGION>
                <ASTRA_DB_APPLICATION_TOKEN>${env.ASTRA_DB_APPLICATION_TOKEN_DEV}</ASTRA_DB_APPLICATION_TOKEN>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>com/datastax/astra/test/integration/**/*.**Test.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>test_astra_prod</id>
            <properties>
                <ASTRA_DB_JAVA_TEST_ENV>astra_prod</ASTRA_DB_JAVA_TEST_ENV>
                <ASTRA_CLOUD_PROVIDER>AWS</ASTRA_CLOUD_PROVIDER>
                <ASTRA_CLOUD_REGION>us-west-2</ASTRA_CLOUD_REGION>
                <ASTRA_DB_APPLICATION_TOKEN>${env.ASTRA_DB_APPLICATION_TOKEN}</ASTRA_DB_APPLICATION_TOKEN>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <includes>
                                <include>com/datastax/astra/test/integration/**/*.**Test.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

    <!-- Organization -->
    <organization>
        <name>DataStax</name>
        <url>https://www.datastax.com</url>
    </organization>

    <!-- Release the client with Apache License -->
    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

</project>
