<?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.oracle.nosql.sdk</groupId>
    <artifactId>spring-data-oracle-nosql</artifactId>
    <version>2.3.0</version>

    <name>Oracle NoSQL Database SDK for Spring Data</name>
    <description>Oracle NoSQL Database SDK for Spring Data</description>
    <url>https://github.com/oracle/nosql-spring-sdk</url>

    <licenses>
        <license>
            <name>The Universal Permissive License (UPL), Version 1.0</name>
            <url>https://www.oracle.com/downloads/licenses/upl-license1.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>oracle</id>
            <name>Oracle</name>
            <organizationUrl>https://www.oracle.com</organizationUrl>
        </developer>
    </developers>

    <organization>
        <name>Oracle Corporation</name>
        <url>https://www.oracle.com</url>
    </organization>

    <scm>
      <connection>scm:git:git@github.com:oracle/nosql-spring-sdk.git</connection>
      <url>https://github.com/oracle/nosql-spring-sdk</url>
    </scm>

    <properties>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>MM-dd-HH-mm-ss</maven.build.timestamp.format>

        <nosqldriver.version>5.4.19</nosqldriver.version>

        <spring.springframework.version>7.0.3</spring.springframework.version>
        <spring.data.version>4.0.2</spring.data.version>
        <org.apache.commons.commons-lang3.version>3.20.0</org.apache.commons.commons-lang3.version>
        <commons.logging>1.3.5</commons.logging>
        <reactor.core.version>3.8.2</reactor.core.version>

        <spring.boot.starter.test.version>4.0.2</spring.boot.starter.test.version>
        <junit.junit.version>6.0.2</junit.junit.version>
        <project.reactor.test.version>3.8.2</project.reactor.test.version>
        <slf4j.version>2.0.17</slf4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>com.oracle.nosql.sdk</groupId>
            <artifactId>nosqldriver</artifactId>
            <version>${nosqldriver.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.springframework.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
            <version>${spring.data.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.springframework.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jspecify</groupId>
            <artifactId>jspecify</artifactId>
            <version>1.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${org.apache.commons.commons-lang3.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons.logging}</version>
        </dependency>

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>${reactor.core.version}</version>
            <scope>compile</scope>
        </dependency>

         <!-- Test -->
        <dependency>
            <groupId> org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>${spring.boot.starter.test.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.jayway.jsonpath</groupId>
                    <artifactId>json-path</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jakarta.xml.bind</groupId>
                    <artifactId>jakarta.xml.bind-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.assertj</groupId>
                    <artifactId>assertj-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.junit.jupiter</groupId>
                    <artifactId>junit-jupiter</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-test</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-test-autoconfigure</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-junit-jupiter</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.skyscreamer</groupId>
                    <artifactId>jsonassert</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.xmlunit</groupId>
                    <artifactId>xmlunit-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <version>${project.reactor.test.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>META-INF/project.properties</include>
                    <include>telemetry.config</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <compilerArgument>-Xlint</compilerArgument>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <show>protected</show>
                    <failOnError>false</failOnError>
                    <sourceFileExcludes>
                        <exclude>
                        </exclude>
                    </sourceFileExcludes>
                    <doclint>all,-missing</doclint>
                    <links>
                        <link>https://oracle.github.io/nosql-java-sdk/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                            <!--goal>test-jar</goal-->
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <configLocation>${project.basedir}/config/checkstyle.xml</configLocation>
                            <suppressionsLocation>${project.basedir}/config/checkstyle-suppressions.xml</suppressionsLocation>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <failOnViolation>true</failOnViolation>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <linkXRef>false</linkXRef>
                </configuration>
                <inherited>true</inherited>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-help-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>show-profiles</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>active-profiles</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- include info in MANIFEST.MF file -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultEntries>false</addDefaultEntries>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            <addBuildEnvironmentEntries>true</addBuildEnvironmentEntries>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <!-- create the tar.gz and .zip archives in package phase -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <!--
                        Drop the version on the name of the tar.gz and zip files generated.
                        Add it to the archive name when released.
                    >
                    <finalName>${project.build.finalName}</finalName-->
                    <!-- assembly id is "sdk," don't append it to the archive names -->
                    <appendAssemblyId>false</appendAssemblyId>
                    <!-- don't deploy at this time -->
                    <attach>false</attach>

                    <descriptors>
                        <descriptor>config/package.xml</descriptor>
                    </descriptors>
                    <tarLongFileMode>gnu</tarLongFileMode>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- add license files to jar files -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.6.3</version>
                <executions>
                    <execution>
                        <id>add license files to runtime jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>jar</executable>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <arguments>
                                <argument>uf</argument>
                                <argument>${project.artifactId}-${project.version}.jar</argument>
                                <argument>../LICENSE.txt</argument>
                                <argument>../THIRD_PARTY_LICENSES.txt</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add license file to javadoc jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>jar</executable>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <arguments>
                                <argument>uf</argument>
                                <argument>${project.artifactId}-${project.version}-javadoc.jar</argument>
                                <argument>../LICENSE.txt</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add license file to source jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>jar</executable>
                            <workingDirectory>${basedir}/target</workingDirectory>
                            <arguments>
                                <argument>uf</argument>
                                <argument>${project.artifactId}-${project.version}-sources.jar</argument>
                                <argument>../LICENSE.txt</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- test plugin -->
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.4</version>
                <configuration>
                    <!-- uncomment below to write stdout to files
                         in target/surefire-reports -->
                    <!-- <redirectTestOutputToFile>true</redirectTestOutputToFile> -->
                    <workingDirectory>${project.build.directory}/test-run</workingDirectory>
                    <systemPropertyVariables>
                        <test.serverType>${serverType}</test.serverType>
                    </systemPropertyVariables>
                    <includes>
                        <include>${included.tests}</include>
                    </includes>
                    <excludes>
                        <exclude>${excluded.tests}</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <build.profile.id>dev</build.profile.id>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>release</name>
                </property>
            </activation>
        </profile>
        <profile>
            <id>doclint-java8-disable</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <properties>
                <javadoc.opts>-Xdoclint:none</javadoc.opts>
            </properties>
        </profile>



        <!-- test profiles used with the test target
         Running tests requires a running on-premise service and httpproxy
         or a running cloud simulator. Required information:
            o endpoint
         Examples:
           mvn -Ptest-cloudsim test -DargLine="-Dtest.endpoint=http://localhost:8080"
           mvn -Ptest-onprem test -DargLine="-Dtest.endpoint=http://localhost:8090"

        These tests are not designed to work directly against the cloud service
        as they require a high rate of DDL operations and generally use more
        resource than a user might want to use in the cloud.

        A secure, onprem configuration requires more information:
          1. user name and password
          2. trust store and optional password for the SSL certificate to use to
          communicate with the proxy
        These are also passed as system properties, e.g.:
          mvn -Ptest-onprem-secure test -DargLine="-Dtest.endpoint=<secure-endpoint> -Dtest.user=<username> -Dtest.password=<user-password> -Dtest.trust=<path-to-trust-store> -Dtest.trust.password=<trust-store-password>"
        -->
        <profile>
            <id>test-cloudsim</id>
            <properties>
                <maven.test.skip>false</maven.test.skip>
                <serverType>cloudsim</serverType>
                <!-- exclude non-server tests and on-premise tests -->
                <excluded.tests>
                    TestIdTypes.java, TestTemplate.java
                </excluded.tests>
            </properties>
        </profile>

        <profile>
            <id>test-cloud</id>
            <properties>
                <maven.test.skip>false</maven.test.skip>
                <serverType>cloud</serverType>
                <!-- exclude non-server tests and on-premise tests -->
                <excluded.tests>
                    TestIdTypes.java, TestTemplate.java
                </excluded.tests>
            </properties>
        </profile>

        <profile>
            <id>test-onprem</id>
            <properties>
                <maven.test.skip>false</maven.test.skip>
                <serverType>onprem</serverType>
                <!-- exclude non-server tests -->
                <excluded.tests></excluded.tests>
            </properties>
        </profile>

        <profile>
            <id>test-onprem-secure</id>
            <properties>
                <maven.test.skip>false</maven.test.skip>
                <serverType>onprem-secure</serverType>
                <!-- exclude non-server tests -->
                <excluded.tests></excluded.tests>
            </properties>
        </profile>
    </profiles>
</project>
