<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<artifactId>jans-lock-server-fips</artifactId>
	<name>Jans lock server (FIPS)</name>
	<packaging>war</packaging>

	<parent>
		<artifactId>jans-lock-server-parent</artifactId>
		<groupId>io.jans</groupId>
		<version>2.1.0</version>
	</parent>

	<prerequisites>
		<maven>${maven.min-version}</maven>
	</prerequisites>

	<build>
		<finalName>${project.artifactId}</finalName>

		<resources>
			<resource>
				<directory>${project.basedir}/../server/src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*.xml</include>
					<include>**/*.properties</include>
					<include>META-INF/services/*.*</include>
				</includes>
			</resource>
		</resources>

		<testResources>
			<testResource>
				<directory>${project.basedir}/../server/src/main/webapp</directory>
				<includes>
					<include>WEB-INF/**</include>
				</includes>
				<filtering>true</filtering>
			</testResource>
			<testResource>
				<directory>src/test/resources</directory>
				<filtering>true</filtering>
			</testResource>
		</testResources>

		<plugins>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>build-oxauth-fips-war</id>
						<phase>process-sources</phase>
						<configuration>
							<target>
								<property name="server.webapp.dir" value="${project.basedir}/../server/target/jans-lock-server-${project.version}"/>
								<property name="dest.webapp.dir" value="${project.build.directory}/${project.artifactId}"/>
								<delete dir="${dest.webapp.dir}"/>
								<mkdir dir="${dest.webapp.dir}"/>
								<copy todir="${dest.webapp.dir}" preservelastmodified="true" overwrite="true">
									<fileset dir="${server.webapp.dir}" includes="**/*"/>
								</copy>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<failOnMissingWebXml>false</failOnMissingWebXml>
					<outdatedCheckPath>tmp</outdatedCheckPath>
					<archive>
						<manifest>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
						</manifest>
						<manifestEntries>
							<Implementation-Build>${buildNumber}</Implementation-Build>
						</manifestEntries>
					</archive>
					<packagingExcludes>
						WEB-INF/lib/bcpkix-jdk18on-*.jar,
						WEB-INF/lib/bcprov-jdk18on-*.jar,
						WEB-INF/lib/bcutil-jdk18on-*.jar,
						WEB-INF/lib/bcmail-jdk18on-*.jar
					</packagingExcludes>
				</configuration>
			</plugin>

			<!-- Build number plugin -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>buildnumber-maven-plugin</artifactId>
				<executions>
					<execution>
						<phase>validate</phase>
						<goals>
							<goal>create</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<doCheck>false</doCheck>
					<doUpdate>false</doUpdate>
				</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>
					</execution>
				</executions>
				<configuration>
					<generateGitPropertiesFile>true</generateGitPropertiesFile>
					<failOnNoGitDirectory>false</failOnNoGitDirectory>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skipTests>true</skipTests>
				</configuration>
			</plugin>
		</plugins>

	</build>

	<dependencies>
		<!-- Bouncycastle Fips -->
		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bc-fips</artifactId>
		</dependency>
		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcpkix-fips</artifactId>
		</dependency>
		<dependency>
			<groupId>org.bouncycastle</groupId>
			<artifactId>bcmail-fips</artifactId>
		</dependency>
	</dependencies>

</project>
