<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>

	<groupId>io.mosip.esignet</groupId>
	<artifactId>mock-plugin</artifactId>
	<version>1.3.0</version>
	<name>mock-plugin</name>
	<packaging>jar</packaging>
	<description>Mockup of a wrapper implementation that is used to showcase the integration with e-Signet</description>
	<url>https://github.com/mosip/esignet-plugins</url>

	<licenses>
		<license>
			<name>MPL 2.0</name>
			<url>https://www.mozilla.org/en-US/MPL/2.0/</url>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/mosip/esignet-plugins.git</connection>
		<developerConnection>scm:git:ssh://github.com:mosip/esignet-plugins.git</developerConnection>
		<url>https://github.com/mosip/esignet-plugins</url>
		<tag>HEAD</tag>
	</scm>

	<developers>
		<developer>
			<name>Mosip</name>
			<email>mosip.emailnotifier@gmail.com</email>
			<organization>io.mosip</organization>
			<organizationUrl>https://github.com/mosip/esignet-plugins</organizationUrl>
		</developer>
	</developers>

	<repositories>
		<repository>
			<id>ossrh</id>
			<name>CentralRepository</name>
			<url>https://oss.sonatype.org/content/repositories/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>
	</repositories>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.version>11</java.version>
		<maven.compiler.source>11</maven.compiler.source>
		<maven.compiler.target>11</maven.compiler.target>
		<maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
		<maven-compiler-plugin.version>2.4</maven-compiler-plugin.version>
		<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
		<maven-gpg-plugin.version>1.5</maven-gpg-plugin.version>
		<maven-source-plugin>2.2.1</maven-source-plugin>
		<nexus-staging-maven-plugin>1.6.7</nexus-staging-maven-plugin>
		<git-commit-id-plugin.version>3.0.1</git-commit-id-plugin.version>
		<maven.jacoco.version>0.8.5</maven.jacoco.version>
		<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
		<maven-shade-plugin.version>2.3</maven-shade-plugin.version>

		<spring-cloud.version>Hoxton.SR8</spring-cloud.version>
		<spring.boot.version>2.3.6.RELEASE</spring.boot.version>

		<kernel-keymanager-service.version>1.2.1.0</kernel-keymanager-service.version>
		<esignet.version>1.5.0</esignet.version>
		<esignet-signup.version>1.1.0</esignet-signup.version>

		<sonar.exclusions>**/dto/**,**/entity/**,**/exception/**,**/spi/**,**/advice/**,**/config/**</sonar.exclusions>
		<sonar.cpd.exclusions>**/dto/**,**/entity/**,**/config/**</sonar.cpd.exclusions>
	</properties>
	<dependencies>

		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
		    <groupId>commons-beanutils</groupId>
		    <artifactId>commons-beanutils</artifactId>
		    <version>1.9.3</version>
		</dependency>
		

		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<version>1.18.22</version>
			<scope>compile</scope>
		</dependency>

		<dependency>
			<groupId>io.mosip.esignet</groupId>
			<artifactId>esignet-core</artifactId>
			<version>${esignet.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>io.mosip.esignet</groupId>
			<artifactId>esignet-integration-api</artifactId>
			<version>${esignet.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>io.mosip.kernel</groupId>
			<artifactId>kernel-keymanager-service</artifactId>
			<version>${kernel-keymanager-service.version}</version>
			<scope>provided</scope>
			<classifier>lib</classifier>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.cloud</groupId>
					<artifactId>spring-cloud-starter-sleuth</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework.security</groupId>
					<artifactId>spring-security-test</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.30</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>io.mosip.signup</groupId>
			<artifactId>signup-integration-api</artifactId>
			<version>${esignet-signup.version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<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>
							<execution>
								<id>pre-integration-test</id>
								<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>
							<execution>
								<id>post-integration-test</id>
								<goals>
									<goal>stop</goal>
								</goals>
							</execution>
							<execution>
								<goals>
									<goal>build-info</goal>
									<goal>repackage</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.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skipTests>${skipTests}</skipTests>
					<skip>false</skip>
					<argLine>
						${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
						--illegal-access=permit
					</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>
				<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>
				<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>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<doclint>none</doclint>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<version>1.6.7</version>
				<extensions>true</extensions>
				<configuration>
					<serverId>ossrh</serverId>
					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
					<autoReleaseAfterClose>false</autoReleaseAfterClose>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<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>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
				</configuration>
			</plugin>
			<plugin>
				<groupId>pl.project13.maven</groupId>
				<artifactId>git-commit-id-plugin</artifactId>
				<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>
