<?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>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.1.6</version>
    <relativePath/>
  </parent>

  <groupId>io.netfoundry</groupId>
  <artifactId>cloud-provider-services</artifactId>
  <version>0.18.5-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>Cloud Provider Services Base Project</name>
  <description>Base project for individual cloud provider services</description>

  <modules>
    <module>cloud-provider-sdk</module>
    <module>cloud-provider-service-base</module>
    <module>cloud-provider-model</module>
  </modules>

  <!-- Properties shared by all modules -->
  <properties>
    <spring-cloud.version>2022.0.4</spring-cloud.version>
    <maven.compiler.release>17</maven.compiler.release>
    <java.version>17</java.version>
    <sonar.projectName>cloud-provider-services</sonar.projectName>
    <sonar.organization>netfoundry</sonar.organization>
    <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <jacoco.version>0.8.0</jacoco.version>
    <sonar.sources>src/main</sonar.sources>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.coverage.exclusions>
      **/config/*, **/service/**/*
    </sonar.coverage.exclusions>
    <sonar.cpd.exclusions>
      **/service/core/*
    </sonar.cpd.exclusions>
    <springdoc-openapi.version>1.4.1</springdoc-openapi.version>
    <snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
    <awssdk.version>2.21.12</awssdk.version>
    <mapstruct.version>1.5.5.Final</mapstruct.version>
  </properties>

  <dependencies>

    <!-- Test Dependencies -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <dependencyManagement>

    <dependencies>

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

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

      <dependency>
        <groupId>io.netfoundry</groupId>
        <artifactId>authorization</artifactId>
        <version>2.1.2</version>
        <classifier>client</classifier>
        <exclusions>
          <!-- Excluding default (4.0) version of httpclient in favor of the newer one (5.0) below -->
          <exclusion>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
          </exclusion>
        </exclusions>
      </dependency>

      <dependency>
        <groupId>jakarta.validation</groupId>
        <artifactId>jakarta.validation-api</artifactId>
        <version>3.0.2</version>
      </dependency>

      <!-- Cloud Provider Services -->
      <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-dependencies</artifactId>
        <version>${spring-cloud.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>io.netfoundry</groupId>
        <artifactId>cloud-provider-service-base</artifactId>
        <version>${project.parent.version}</version>
      </dependency>
      <dependency>
        <groupId>io.netfoundry</groupId>
        <artifactId>cloud-provider-model</artifactId>
        <version>${project.parent.version}</version>
      </dependency>
      <dependency>
        <groupId>io.netfoundry</groupId>
        <artifactId>cloud-provider-sdk</artifactId>
        <version>${project.parent.version}</version>
      </dependency>

      <!-- AWS -->
      <dependency>
        <groupId>software.amazon.awssdk</groupId>
        <artifactId>bom</artifactId>
        <version>${awssdk.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>dynamodb-lock-client</artifactId>
        <version>1.2.0</version>
      </dependency>

      <!-- Misc -->
      <dependency>
        <groupId>org.mapstruct</groupId>
        <artifactId>mapstruct</artifactId>
        <version>${mapstruct.version}</version>
      </dependency>

    </dependencies>
  </dependencyManagement>
  <profiles>
    <profile>
      <id>dependence_check</id>
      <build>
        <plugins>
          <!-- checks dependencies for vulnerabilities -->
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>7.4.4</version>
            <configuration>
              <format>ALL</format>
              <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
              <versionCheckEnabled>true</versionCheckEnabled>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>xml-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>transform</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <transformationSets>
                <transformationSet>
                  <dir>${project.build.directory}</dir>
                  <includes>
                    <include>dependency-check-report.xml</include>
                  </includes>
                  <stylesheet>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.9.1.2184</version>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>


</project>
