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

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

	<modelVersion>4.0.0</modelVersion>
	<groupId>io.inji.certify</groupId>
	<artifactId>certify-parent</artifactId>
	<version>1.0.0-alpha.1</version>
    <packaging>pom</packaging>
    <name>certify</name>
	<description>Parent project for MOSIP certify</description>
	<url>https://github.com/inji/inji-certify</url>

	<licenses>
		<license>
			<name>Apache 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/inji/inji-certify.git</connection>
		<developerConnection>scm:git:ssh://github.com:inji/inji-certify.git</developerConnection>
		<url>https://github.com/inji/inji-certify</url>
		<tag>HEAD</tag>
	</scm>

	<developers>
		<developer>
			<name>Mosip</name>
			<email>mosip.emailnotifier@gmail.com</email>
			<organization>io.inji</organization>
			<organizationUrl>https://inji.io</organizationUrl>
		</developer>
	</developers>

	<repositories>
		<repository>
			<id>ossrh-central</id>
			<name>MavenCentralRepository</name>
			<url>https://central.sonatype.com/repository/maven-snapshots</url>
			<layout>default</layout>
			<snapshots>
				<enabled>true</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>central</id>
			<name>MavenCentral</name>
			<layout>default</layout>
			<url>https://repo1.maven.org/maven2</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>danubetech-maven-public</id>
			<url>https://repo.danubetech.com/repository/maven-public/</url>
		</repository>
	</repositories>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://central.sonatype.com/repository/maven-snapshots/</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://central.sonatype.com/api/v1/publisher</url>
		</repository>
	</distributionManagement>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<!-- maven -->
		<maven.compiler.release>21</maven.compiler.release>
		<maven.compiler.source>21</maven.compiler.source>
		<maven.compiler.target>21</maven.compiler.target>
		<maven.compiler.version>3.8.1</maven.compiler.version>
		<maven.jar.plugin.version>3.3.0</maven.jar.plugin.version>
		<maven.war.plugin.version>3.3.2</maven.war.plugin.version>
		<maven.surefire.plugin.version>3.2.5</maven.surefire.plugin.version>
		<maven.jacoco.version>0.8.12</maven.jacoco.version>
		<maven.sonar.plugin.version>3.7.0.1746</maven.sonar.plugin.version>
		<maven.javadoc.version>3.6.3</maven.javadoc.version>
		<maven-shade-plugin.version>4.4.3</maven-shade-plugin.version>

		<spring.boot.version>3.2.3</spring.boot.version>
		<central.publishing.maven.plugin.version>0.8.0</central.publishing.maven.plugin.version>

		<java.version>21</java.version>
		<jose4j.version>0.6.5</jose4j.version>
		<kernel.core.version>1.3.0-beta.1</kernel.core.version>
		<kernel.keymanager.version>1.4.0</kernel.keymanager.version>
		<jsonld.common.java.version>0.5.0</jsonld.common.java.version>
		<springdoc-openapi-webmvc-ui-version>2.5.0</springdoc-openapi-webmvc-ui-version>
		<commons.validator.version>1.7</commons.validator.version>
		<google.guava.version>18.0</google.guava.version>
	</properties>

	<modules>
		<module>certify-service</module>
		<module>certify-core</module>
		<module>certify-integration-api</module>
	</modules>
	
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-validation</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
		</dependency>
		<dependency>
			<groupId>org.bitbucket.b_c</groupId>
			<artifactId>jose4j</artifactId>
			<version>${jose4j.version}</version>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<!--<version>1.18.30</version>  -->
		</dependency> 
		<dependency>
			<groupId>jakarta.servlet</groupId>
			<artifactId>jakarta.servlet-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.json</groupId>
			<artifactId>json</artifactId>
			<version>20241224</version>
		</dependency>
		<dependency>
			<groupId>org.junit.vintage</groupId>
			<artifactId>junit-vintage-engine</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>2023.0.0</version>
				<type>pom</type>
				<scope>import</scope>
				<exclusions>
					<exclusion>
						<groupId>org.mockito</groupId>
						<artifactId>mockito-bom</artifactId>
					</exclusion>
				</exclusions>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<profiles>
		<profile>
			<id>sonar</id>
			<properties>
				<sonar.sources>.</sonar.sources>
				<sonar.inclusions>src/main/java/**,src/main/resources/**</sonar.inclusions>
				<sonar.exclusions>${sonar.coverage.exclusions}</sonar.exclusions>
				<sonar.host.url>https://sonarcloud.io</sonar.host.url>
			</properties>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.sonarsource.scanner.maven</groupId>
						<artifactId>sonar-maven-plugin</artifactId>
						<version>${maven.sonar.plugin.version}</version>
						<executions>
							<execution>
								<phase>verify</phase>
								<goals>
									<goal>sonar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>openapi-doc-generate-profile</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.springframework.boot</groupId>
						<artifactId>spring-boot-maven-plugin</artifactId>
					<!--	<version>${spring.boot.version}</version> -->
						<configuration>
							<executable>true</executable>
							<layout>ZIP</layout>
						</configuration>
						<executions>
							<!-- Build info and repackage -->
							<execution>
								<id>build-info-repackage</id>
								<goals>
									<goal>build-info</goal>
									<goal>repackage</goal>
								</goals>
								<configuration>
									<attach>false</attach>
								</configuration>
							</execution>
							<!-- Integration test startup -->
							<execution>
								<id>pre-integration-test</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>start</goal>
								</goals>
								<configuration>
									<folders>
										<folder>src/test/resources</folder>
									</folders>
									<profiles>
										<profile>openapi-profile</profile>
									</profiles>
									<arguments>
										<argument>--server.port=8090</argument>
										<argument>--server.servlet.path=/app/generic</argument>
									</arguments>
								</configuration>
							</execution>
							<!-- Integration test shutdown -->
							<execution>
								<id>post-integration-test</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>stop</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.springdoc</groupId>
						<artifactId>springdoc-openapi-maven-plugin</artifactId>
						<version>0.2</version>
						<executions>
							<execution>
								<id>integration-test</id>
								<goals>
									<goal>generate</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<apiDocsUrl>http://localhost:8090/app/generic/v3/api-docs</apiDocsUrl>
							<outputFileName>openapi.json</outputFileName>
							<outputDir>${project.build.directory}</outputDir>
							<skip>false</skip>
						</configuration>
					</plugin>
				</plugins>
			</build>
        </profile>

	</profiles>

	<build>
		<plugins>
			<!-- <plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<version>${spring.boot.version}</version> 
				<configuration>
					<mainClass>io.mosip.certify.CertifyServiceApplication</mainClass>
				</configuration>
        	</plugin> -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${maven.surefire.plugin.version}</version>
				<configuration>
					<skipTests>${skipTests}</skipTests>
					<skip>false</skip>
					<argLine>
						${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
					</argLine>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>${maven.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>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven.jar.plugin.version}</version>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
						<manifestEntries>
							<Project-Name>${project.name}</Project-Name>
							<Project-Version>${project.version}</Project-Version>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>${maven.war.plugin.version}</version>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
						<manifestEntries>
							<Project-Name>${project.name}</Project-Name>
							<Project-Version>${project.version}</Project-Version>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>${maven.javadoc.version}</version>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<doclint>none</doclint>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.sonatype.central</groupId>
				<artifactId>central-publishing-maven-plugin</artifactId>
				<version>${central.publishing.maven.plugin.version}</version>
				<extensions>true</extensions>
				<configuration>
					<publishingServerId>ossrh</publishingServerId>
					<autoPublish>false</autoPublish>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.2.1</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar-no-fork</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-gpg-plugin</artifactId>
				<version>1.5</version>
				<executions>
					<execution>
						<id>sign-artifacts</id>
						<phase>verify</phase>
						<goals>
							<goal>sign</goal>
						</goals>
						<configuration>
							<gpgArguments>
								<arg>--pinentry-mode</arg>
								<arg>loopback</arg>
							</gpgArguments>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven.compiler.version}</version>
				<configuration>
					<forceJavacCompilerUse>true</forceJavacCompilerUse>
					<release>${maven.compiler.target}</release>
					<source>${maven.compiler.target}</source>
					<target>${maven.compiler.target}</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>3.8.1</version>
				<executions>
					<execution>
						<id>copy</id>
						<phase>install</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>
								${project.build.directory}/lib
							</outputDirectory>
							 <includeScope>provided</includeScope>
							<excludeTransitive>true</excludeTransitive>
							<!-- <excludeScope>compile</excludeScope> -->
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>pl.project13.maven</groupId>
				<artifactId>git-commit-id-plugin</artifactId>
				<version>3.0.1</version>
				<executions>
					<execution>
						<id>get-the-git-infos</id>
						<goals>
							<goal>revision</goal>
						</goals>
						<phase>validate</phase>
					</execution>
				</executions>
				<configuration>
					<generateGitPropertiesFile>true</generateGitPropertiesFile>
					<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
					<includeOnlyProperties>
						<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
						<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
					</includeOnlyProperties>
					<commitIdGenerationMode>full</commitIdGenerationMode>
					<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
					<format>json</format>
				</configuration>
			</plugin>
		</plugins>
	</build>


</project>
