<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>io.netfoundry</groupId>
    <artifactId>cloud-provider-services</artifactId>
    <version>0.19.1</version>
    <relativePath/>
  </parent>

  <artifactId>oci-provider</artifactId>
  <name>OCI Provider Service</name>
  <description>OCI cloud host provisioning service</description>
  <version>0.0.1-SNAPSHOT</version>

  <properties>
    <maven.compiler.release>21</maven.compiler.release>
    <java.version>21</java.version>
    <jersey3.version>3.1.5</jersey3.version>
    <jakarta9.ws.rs-api.version>3.1.0</jakarta9.ws.rs-api.version>
    <jakarta9.annotations.version>2.1.1</jakarta9.annotations.version>
    <oci.sdk.version>3.34.1</oci.sdk.version>
    <sonar.projectName>oci-provider</sonar.projectName>
    <sonar.projectKey>netfoundry_oci-provider-service</sonar.projectKey>
    <sonar.organization>netfoundry</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <jacoco.version>0.8.11</jacoco.version>
    <sonar.sources>src/main</sonar.sources>
    <sonar.tests>src/test</sonar.tests>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.coverage.exclusions>
      **/config/*
    </sonar.coverage.exclusions>
    <sonar.cpd.exclusions/>
  </properties>
  <dependencies>

    <!--  NF dependencies -->
    <dependency>
      <groupId>io.netfoundry</groupId>
      <artifactId>common-util-framework</artifactId>
      <version>3.0.1</version>
    </dependency>

    <!-- Spring Dependencies -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-tracing-bridge-brave</artifactId>
    </dependency>

    <!--  Provider framework dependencies -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>cloud-provider-service-base</artifactId>
    </dependency>

    <dependency>  <!-- Metrics reporting -->
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-core</artifactId>
    </dependency>

    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-elastic</artifactId>
    </dependency>

    <!-- Amazon SDKs -->
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>secretsmanager</artifactId>
    </dependency>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>dynamodb</artifactId>
    </dependency>


    <!--  Oracle cloud infrastructure maven dependencies -->

    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-common</artifactId>
    </dependency>

    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-core</artifactId>
    </dependency>

    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-identity</artifactId>
    </dependency>

    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-workrequests</artifactId>
    </dependency>

    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-marketplace</artifactId>
    </dependency>

    <dependency>
      <groupId>org.glassfish.jersey.connectors</groupId>
      <artifactId>jersey-apache-connector</artifactId>
      <version>${jersey3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>${jersey3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-common</artifactId>
      <version>${jersey3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
      <version>${jersey3.version}</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.media</groupId>
      <artifactId>jersey-media-json-jackson</artifactId>
      <version>${jersey3.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
      <version>${jakarta9.ws.rs-api.version}</version>
    </dependency>
    <dependency>
      <groupId>jakarta.annotation</groupId>
      <artifactId>jakarta.annotation-api</artifactId>
      <version>${jakarta9.annotations.version}</version>
    </dependency>

  <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
    </dependency>
    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-addons-apache-configurator-jersey3</artifactId>
    </dependency>
    <dependency>
      <groupId>com.oracle.oci.sdk</groupId>
      <artifactId>oci-java-sdk-objectstorage</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <version>4.0.1</version>
    </dependency>
    <dependency>
      <groupId>jakarta.activation</groupId>
      <artifactId>jakarta.activation-api</artifactId>
      <version>2.1.2</version>
    </dependency>

    <!-- Misc dependencies -->
    <dependency>
      <groupId>com.vdurmont</groupId>
      <artifactId>semver4j</artifactId>
      <version>3.1.0</version>
    </dependency>

    <dependency>
      <groupId>org.mapstruct</groupId>
      <artifactId>mapstruct</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <dependency>  <!-- key generator for small(er) ids than UUID -->
      <groupId>com.aventrix.jnanoid</groupId>
      <artifactId>jnanoid</artifactId>
      <version>2.0.0</version>
    </dependency>

    <dependency>
      <groupId>net.jodah</groupId>
      <artifactId>failsafe</artifactId>
      <version>2.4.4</version>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.15.2</version>
    </dependency>

  </dependencies>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-bom</artifactId>
        <version>${oci.sdk.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.oracle.oci.sdk</groupId>
        <artifactId>oci-java-sdk-common-httpclient-jersey3</artifactId>
        <version>${oci.sdk.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <plugins>
			<!--  provides Spring Boot support in Maven, letting you package executable jar or war archives and run an application “in-place” -->
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>build-info</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

			<!-- will provide git information in the healthcheck localEndpoint -->
      <plugin>
        <groupId>pl.project13.maven</groupId>
        <artifactId>git-commit-id-plugin</artifactId>
        <version>4.9.10</version>
      </plugin>

			<!-- Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports. -->
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.2.5</version>
        <configuration>
          <includes>
            <include>**/*Test.java</include>
          </includes>
          <systemPropertyVariables>
            <org.springframework.restdocs.outputDir>
              ${project.build.directory}/generated-snippets
            </org.springframework.restdocs.outputDir>
            <org.springframework.restdocs.javadocJsonDir>
              ${project.build.directory}/generated-javadoc-json
            </org.springframework.restdocs.javadocJsonDir>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-generated-api-docs-to-static-docs</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/static/docs</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.build.directory}/generated-docs</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
          <execution>
            <id>copy-redocs-to-static-docs</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}/static/docs</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.build.directory}/generated-snippets</directory>
                  <includes>
                    <include>**/*.redoc</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
          <execution>
            <id>post-unit-test</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
							<!-- Sets the path to the file which contains the execution
                data. -->
              <dataFile>target/jacoco.exec</dataFile>
							<!-- Sets the output directory for the code coverage report. -->
              <outputDirectory>target/jacoco-ut</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.12.1</version>
        <configuration>
          <source>21</source> <!-- depending on your project -->
          <target>21</target> <!-- depending on your project -->
          <annotationProcessorPaths>
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok</artifactId>
              <version>${lombok.version}</version>
            </path>
						<!-- This is needed when using Lombok 1.18.16 and above -->
            <path>
              <groupId>org.projectlombok</groupId>
              <artifactId>lombok-mapstruct-binding</artifactId>
              <version>0.2.0</version>
            </path>
            <path>
              <groupId>org.mapstruct</groupId>
              <artifactId>mapstruct-processor</artifactId>
              <version>${mapstruct.version}</version>
            </path>
						<!-- other annotation processors -->
          </annotationProcessorPaths>
        </configuration>
      </plugin>
			<!-- checks dependencies for vulnerabilities -->
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>9.0.9</version>
        <configuration>
					<!-- Fail Build On CVSS core more than 8.0 which is HIGH-->
					<!-- <failBuildOnCVSS>8</failBuildOnCVSS> -->
					<!-- Generate all report formats -->
          <format>ALL</format>
					<!-- Don't use Nexus Analyzer -->
          <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
          <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
					<!-- Am I the latest version? -->
          <versionCheckEnabled>true</versionCheckEnabled>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <configuration>
          <transformationSets>
            <transformationSet>
              <dir>${project.build.directory}</dir>
              <includes>
                <include>dependency-check-report.xml</include>
              </includes>
              <stylesheet>src/main/resources/dependencycheck_to_pmd.xsl</stylesheet>
              <outputDir>target</outputDir>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.MergeFileMapper">
                  <targetName>dependency-check-report-pmd.xml</targetName>
                </fileMapper>
              </fileMappers>
            </transformationSet>
          </transformationSets>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon</artifactId>
            <version>8.7</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>3.10.0.2594</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>
