<?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>io.netfoundry</groupId>
  <artifactId>ziti-java-management-client</artifactId>
  <version>0.18.2-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>NetFoundry Ziti Management Client</name>
  <description></description>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>3.2.5</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>


  <properties>
    <!-- Timestamp and application version number are injected into the application
      and bootstrap properties files, and used for logging purposes ... to track
      build version that the logs were made against. -->
    <timestamp>${maven.build.timestamp}</timestamp>
    <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
    <maven.compiler.release>21</maven.compiler.release>
    <java.version>21</java.version>
    <application.version.number>${project.version}</application.version.number>

    <!-- Basic settings -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <!-- JUnit version -->
    <junit-jupiter.version>5.5.2</junit-jupiter.version>

    <!-- Sonar, Lint, Java Code Coverage settings. These apply to build time
      only. -->
    <skip.dump>true</skip.dump>
    <jacoco.version>0.8.11</jacoco.version>
    <sonar.jacoco.reportPaths>${basedir}/target/jacoco.exec,${basedir}/target/jacoco-it.exec</sonar.jacoco.reportPaths>
    <sonar.projectName>ziti-java-management-client</sonar.projectName>
    <sonar.organization>netfoundry</sonar.organization>
    <sonar.sources>src/main</sonar.sources>
     <sonar.tests>src/test</sonar.tests>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
  </properties>


  <dependencies>

    <!-- Spring -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
    </dependency>

    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
      <scope>provided</scope>
    </dependency>

    <!-- NetFoundry Dependencies -->
    <dependency>
      <groupId>io.netfoundry</groupId>
      <artifactId>common-util-framework</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>

    <!-- Caching -->
    <dependency>
      <groupId>com.github.ben-manes.caffeine</groupId>
      <artifactId>caffeine</artifactId>
    </dependency>

    <!-- Misc -->
    <dependency>  <!-- semantic version parsing and comparison -->
      <groupId>com.vdurmont</groupId>
      <artifactId>semver4j</artifactId>
      <version>3.1.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>io.github.resilience4j</groupId>
      <artifactId>resilience4j-circuitbreaker</artifactId>
      <version>2.2.0</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>33.0.0-jre</version>
    </dependency>
    
    <dependency>
        <groupId>org.springframework.retry</groupId>
        <artifactId>spring-retry</artifactId>
    </dependency>

    <dependency>
      <groupId>com.nimbusds</groupId>
      <artifactId>oauth2-oidc-sdk</artifactId>
      <version>11.21</version>
    </dependency>

    <!-- Testing and Test related dependencies -->

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-test</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-test-autoconfigure</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>


  <dependencyManagement>
    <dependencies>
    </dependencies>
  </dependencyManagement>


  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>pre-unit-test</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>prepare-agent</id>
            <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>
          <execution>
            <id>pre-integration-test</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <configuration>
              <destFile>${project.build.directory}/jacoco-it.exec</destFile>
              <append>true</append>
              <propertyName>failsafe.argLine</propertyName>
            </configuration>
          </execution>
          <execution>
            <id>post-integration-test</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>report-aggregate</goal>
            </goals>
          </execution>
          <execution>
            <id>pull-test-data</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>dump</goal>
            </goals>
            <configuration>
              <destFile>${project.build.directory}/jacoco-it-${app.host}:${app.port}.exec</destFile>
              <address>${app.host}</address>
              <port>${app.port}</port>
              <reset>false</reset>
              <skip>${skip.dump}</skip>
            </configuration>
          </execution>
          <execution>
            <id>merge-test-data</id>
            <goals>
              <goal>merge</goal>
            </goals>
            <configuration>
              <destFile>target/jacoco-it.exec</destFile>
              <skip>${skip.dump}</skip>
              <fileSets>
                <fileSet
                  implementation="org.apache.maven.shared.model.fileset.FileSet">
                  <directory>target</directory>
                  <includes>
                    <include>*it*.exec</include>
                    <include>jacoco.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <append>true</append>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.4</version>
          </dependency>
        </dependencies>
      </plugin>
       <!-- checks dependencies for vulnerabilities -->
      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>9.0.9</version>
        <configuration>
          <format>ALL</format>
          <!-- Don't use Nexus Analyzer -->
          <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
          <centralAnalyzerEnabled>false</centralAnalyzerEnabled>
          <!-- Don't scan provided artifacts -->
          <skipProvidedScope>true</skipProvidedScope>
          <!-- Am I the latest version? -->
          <versionCheckEnabled>true</versionCheckEnabled>
          <!--suppression Files -->
          <suppressionFiles>owasp/suppressed-dependencies.xml</suppressionFiles>
        </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>
