<?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.21.0</version>
		<relativePath/>
	</parent>

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

	<properties>
		<maven.compiler.release>21</maven.compiler.release>
		<java.version>21</java.version>
		<jakarta9.ws.rs-api.version>3.1.0</jakarta9.ws.rs-api.version>
		<sonar.projectName>gcp-provider</sonar.projectName>
		<sonar.projectKey>netfoundry_gcp-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/>
		<springdoc-openapi.version>1.4.1</springdoc-openapi.version>
		<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
	</properties>

	<dependencies>


		<!--  NF dependencies -->
		<dependency>
			<groupId>io.netfoundry</groupId>
			<artifactId>common-util-framework</artifactId>
		</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-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>

		<!-- GCP SDKs -->
		<dependency>
			<groupId>com.google.auth</groupId>
			<artifactId>google-auth-library-oauth2-http</artifactId>
			<version>1.30.1</version>
		</dependency>

		<dependency>
			<groupId>com.google.api-client</groupId>
			<artifactId>google-api-client</artifactId>
			<version>2.7.1</version>
		</dependency>

		<dependency>
			<groupId>com.google.apis</groupId>
			<artifactId>google-api-services-compute</artifactId>
			<version>v1-rev20241201-2.0.0</version>
		</dependency>

		<!-- Misc dependencies -->
		<dependency>
			<groupId>org.mapstruct</groupId>
			<artifactId>mapstruct</artifactId>
		</dependency>

		<dependency>
			<groupId>net.logstash.logback</groupId>
			<artifactId>logstash-logback-encoder</artifactId>
		</dependency>

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

		<dependency>
			<groupId>jakarta.ws.rs</groupId>
			<artifactId>jakarta.ws.rs-api</artifactId>
			<version>${jakarta9.ws.rs-api.version}</version>
		</dependency>


		<!-- Provides full logging of all HTTP incoming requests and outgoing responses. Uncomment this and add to application.properties:

        logging.level.org.zalando.logbook.Logbook=TRACE
        logbook.format.style=http

        -->
		<!--
        <dependency>
          <groupId>org.zalando</groupId>
          <artifactId>logbook-spring-boot-starter</artifactId>
          <version>3.0.0</version>
        </dependency>
        -->

	</dependencies>

	<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>
			</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>
				<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>
		</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>
    <profiles>
        <profile>
            <id>dependency_check</id>
            <build>
                <plugins>
					<plugin>
						<groupId>org.owasp</groupId>
						<artifactId>dependency-check-maven</artifactId>
						<version>9.0.9</version>
						<configuration>
						<!-- <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>owasp/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>
            </build>
        </profile>
    </profiles>
</project>
