<?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>Data API Client</name>
    <version>1.5.3</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>langchain4j-astradb</module>
        <!-- <module>examples</module> -->
        <!-- <module>tools</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.9</slf4j.version>
        <logback.version>1.5.7</logback.version>
        <jackson.version>2.17.2</jackson.version>
        <lombok.version>1.18.34</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>

        <!-- Test -->
        <test.skipped>false</test.skipped>
        <assertj.version>3.26.3</assertj.version>
        <junit-jupiter.version>5.10.3</junit-jupiter.version>

        <!-- Maven -->
        <required-maven.version>3.6.3</required-maven.version>
        <maven.plugin.compiler.source>11</maven.plugin.compiler.source>
        <maven.plugin.compiler.target>11</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.4.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.0</version.maven.plugin.surefire>

    </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>

            <!-- Dependency to Devops API -->
            <dependency>
                <groupId>com.datastax.astra</groupId>
                <artifactId>astra-sdk-devops</artifactId>
                <version>${devops-sdk.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>

            <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.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>${version.maven.plugin.gpg}</version>
            </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>
                    </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>
                </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>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </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>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</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.5.3</tag>
    </scm>

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

    <profiles>
        <profile>
            <id>release</id>
            <modules>
                <module>astra-db-java</module>
                <module>langchain4j-astradb</module>
            </modules>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </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>
