<?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</artifactId>
    <name>Java Client Library for Data API</name>
    <version>1.0.0</version>
    <description>Implementation of a client to the Astra/Stargate Data API written in Java</description>
    <url>https://github.com/datastax/astra-db-java</url>
    <inceptionYear>2024</inceptionYear>

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

        <!-- Sonar -->
        <sonar.organization>clun-datastax</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <required-maven.version>3.6.3</required-maven.version>

        <!-- Third Party Libraries -->
        <devops-sdk.version>1.2.7</devops-sdk.version>
        <slf4j.version>2.0.9</slf4j.version>
        <logback.version>1.5.3</logback.version>
        <jackson.version>2.17.0</jackson.version>
        <lombok.version>1.18.32</lombok.version>
        <retry4j.version>0.15.0</retry4j.version>
        <awaitility.version>4.2.1</awaitility.version>
        <mockwebserver.version>4.12.0</mockwebserver.version>
        <uuid-generator.version>5.0.0</uuid-generator.version>

        <!-- Test -->
        <test.skipped>false</test.skipped>
        <assertj.version>3.25.3</assertj.version>
        <junit-jupiter.version>5.10.2</junit-jupiter.version>

        <!-- Maven -->
        <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.6.1</version.maven.plugin.dependency>
        <version.maven.plugin.enforcer>3.4.1</version.maven.plugin.enforcer>
        <version.maven.plugin.gpg>3.2.2</version.maven.plugin.gpg>
        <version.maven.plugin.jacoco>0.8.11</version.maven.plugin.jacoco>
        <version.maven.plugin.javadoc>3.6.3</version.maven.plugin.javadoc>
        <version.maven.plugin.jar>3.3.0</version.maven.plugin.jar>
        <version.maven.plugin.license>2.4.0</version.maven.plugin.license>
        <version.maven.plugin.nexus>1.6.13</version.maven.plugin.nexus>
        <version.maven.plugin.release>3.0.1</version.maven.plugin.release>
        <version.maven.plugin.resources>3.3.1</version.maven.plugin.resources>
        <version.maven.plugin.source>3.3.0</version.maven.plugin.source>
        <version.maven.plugin.surefire>3.2.5</version.maven.plugin.surefire>

    </properties>

    <dependencies>

        <!-- 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>com.evanlennick</groupId>
            <artifactId>retry4j</artifactId>
            <version>${retry4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${lombok.version}</version>
        </dependency>

        <!-- Working with JSON -->
        <dependency>
            <groupId>com.fasterxml.jackson</groupId>
            <artifactId>jackson-bom</artifactId>
            <version>${jackson.version}</version>
            <scope>runtime</scope>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
            <version>${jackson.version}</version>
        </dependency>

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


    </dependencies>

    <!-- 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>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>${version.maven.plugin.license}</version>
                <configuration>
                    <verbose>false</verbose>
                    <extraExtensions>
                        <myProprietaryExtension>java</myProprietaryExtension>
                    </extraExtensions>
                </configuration>
                <executions>
                    <execution>
                        <id>add-license</id>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                        <phase>process-sources</phase>
                        <configuration>
                            <projectName>Data API Java Client</projectName>
                            <organizationName>DataStax</organizationName>
                            <licenseName>apache2</licenseName>
                            <licenseResolver>${project.baseUri}/src/license</licenseResolver>
                            <addJavaLicenseAfterPackage>true</addJavaLicenseAfterPackage>
                            <sectionDelimiter>--</sectionDelimiter>
                            <roots>
                                <root>src/main/java</root>
                            </roots>
                        </configuration>
                    </execution>
                </executions>
            </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.0.0</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>
            <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>