<?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>

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.4.5</version>
	</parent>

	<groupId>io.netfoundry</groupId>
	<artifactId>notification</artifactId>
	<name>notification</name>
	<version>0.0.2-SNAPSHOT</version>
	<description>Notification Service</description>

	<properties>
		<spring-cloud.version>2024.0.1</spring-cloud.version>
		<jacoco.version>0.8.11</jacoco.version>
        <flyway.version>11.20.3</flyway.version>
		<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
		<sonar.host.url>https://sonarcloud.io</sonar.host.url>
		<sonar.coverage.exclusions>**/config/*,**/core/*,**/metadata/*,**/restapi/*,**/rx/*,**/tx/*,**/util/*,
			**/restapi/CommonExceptionHandler.java</sonar.coverage.exclusions>
	    <sonar.projectName>notification</sonar.projectName>
	    <sonar.projectKey>io.netfoundry:notification</sonar.projectKey>
	    <sonar.organization>netfoundry</sonar.organization>
        <sonar.sources>src/main</sonar.sources>
        <sonar.tests>src/test</sonar.tests>
		<spring-auto-restdocs.version>2.0.5</spring-auto-restdocs.version>
		<springdoc-openapi.version>2.8.6</springdoc-openapi.version>
		<snippetsDirectory>${project.build.directory}/generated-snippets</snippetsDirectory>
		<maven.compiler.release>21</maven.compiler.release>
		<java.version>21</java.version>
	</properties>


	<dependencies>

		<!-- Spring Boot Dependencies -->

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

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

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

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

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

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

		<dependency>
			<groupId>org.springframework.retry</groupId>
			<artifactId>spring-retry</artifactId>
		</dependency>


		<!-- Spring Cloud Dependencies -->

        <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-aws-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>io.awspring.cloud</groupId>
            <artifactId>spring-cloud-aws-starter-sqs</artifactId>
        </dependency>

		<dependency>
			<groupId>io.awspring.cloud</groupId>
			<artifactId>spring-cloud-aws-starter-secrets-manager</artifactId>
		</dependency>


		<!-- Jackson extended dependencies -->

		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-yaml</artifactId>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.dataformat</groupId>
			<artifactId>jackson-dataformat-csv</artifactId>
		</dependency>

		<dependency>
			<groupId>com.fasterxml.jackson.datatype</groupId>
			<artifactId>jackson-datatype-jsr310</artifactId>
		</dependency>


		<!-- NetFoundry Dependencies -->

		<dependency>
			<groupId>io.netfoundry</groupId>
			<artifactId>common-util-framework</artifactId>
			<version>4.0.0</version>
		</dependency>
	
		<dependency>
			<groupId>io.netfoundry</groupId>
			<artifactId>authorization</artifactId>
			<version>2.5.0</version>
			<classifier>client</classifier>
			<exclusions>
				<exclusion>
					<groupId>org.redisson</groupId>
					<artifactId>redisson</artifactId>
				</exclusion>
				<exclusion>
					<groupId>io.netfoundry</groupId>
					<artifactId>common-util-framework</artifactId>
				</exclusion>
			</exclusions>
		</dependency>


		<!-- Database Dependencies -->

		<dependency>
			<groupId>com.mysql</groupId>
			<artifactId>mysql-connector-j</artifactId>
			<version>8.4.0</version>
		</dependency>

		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-core</artifactId>
		</dependency>

		<dependency>
			<groupId>org.flywaydb</groupId>
			<artifactId>flyway-mysql</artifactId>
		</dependency>


		<!-- Misc. Minor Dependencies -->

		<dependency>
			<groupId>io.micrometer</groupId>
			<artifactId>micrometer-tracing-bridge-brave</artifactId>
		</dependency>

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

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

		<dependency>
			<groupId>javax.mail</groupId>
			<artifactId>mailapi</artifactId>
			<version>1.4.3</version>
		</dependency>

		<dependency>
			<groupId>org.apache.velocity</groupId>
			<artifactId>velocity-engine-core</artifactId>
			<version>2.3</version>
		</dependency>

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


		<!-- Testing Dependencies -->

		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest</artifactId>
			<scope>test</scope>
		</dependency>

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

		<dependency>
			<groupId>com.icegreen</groupId>
			<artifactId>greenmail-spring</artifactId>
			<version>1.5.14</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.h2database</groupId>
			<artifactId>h2</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.jacoco</groupId>
			<artifactId>org.jacoco.agent</artifactId>
			<version>${jacoco.version}</version>
			<classifier>runtime</classifier>
			<scope>test</scope>
		</dependency>


		<!-- Documentation Dependencies -->

		<dependency>
			<groupId>capital.scalable</groupId>
			<artifactId>spring-auto-restdocs-core</artifactId>
			<version>${spring-auto-restdocs.version}</version>
			<scope>test</scope>
		</dependency>

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

	</dependencies>



	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>io.awspring.cloud</groupId>
				<artifactId>spring-cloud-aws-dependencies</artifactId>
				<version>3.2.0</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 health check 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>
				<groupId>org.apache.maven.plugins</groupId>
				<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-javadoc-plugin</artifactId>
				<version>3.6.3</version>
				<extensions>true</extensions>
				<executions>
					<execution>
						<id>generate-javadoc-json</id>
						<phase>compile</phase>
						<goals>
							<goal>javadoc-no-fork</goal>
						</goals>
						<configuration>
							<doclet>capital.scalable.restdocs.jsondoclet.ExtractDocumentationAsJsonDoclet</doclet>
							<docletArtifact>
								<groupId>capital.scalable</groupId>
								<artifactId>spring-auto-restdocs-json-doclet-jdk9</artifactId>
								<version>2.0.8</version>
							</docletArtifact>
							<destDir>generated-javadoc-json</destDir>
							<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
							<useStandardDocletOptions>false</useStandardDocletOptions>
							<show>package</show>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.asciidoctor</groupId>
				<artifactId>asciidoctor-maven-plugin</artifactId>
				<version>2.2.3</version>
				<executions>
					<execution>
						<id>generate-docs</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>process-asciidoc</goal>
						</goals>
						<configuration>
							<backend>html</backend>
							<doctype>book</doctype>
							<sourceDocumentName>index.adoc</sourceDocumentName>
							<attributes>
								<snippets>${snippetsDirectory}</snippets>
							</attributes>
						</configuration>
					</execution>
				</executions>
			</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>
			<!-- test coverage  -->
			<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>
		</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>7.1.0</version>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<!-- Fail Build On CVSS core more then 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>
				<executions>
					<execution>
						<goals>
							<goal>transform</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<transformationSets>
						<transformationSet>
							<dir>target</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>
					<dependency>
						<groupId>org.owasp</groupId>
						<artifactId>dependency-check-core</artifactId>
						<version>7.1.0</version>
					</dependency>
				</dependencies>
			</plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
