<?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>io.earcam.maven</groupId>
		<artifactId>io.earcam.maven.pom</artifactId>
		<version>2.2.2</version>
	</parent>

	<groupId>io.earcam</groupId>
	<artifactId>io.earcam.unexceptional</artifactId>
	<version>1.0.0</version>
	<packaging>jar</packaging>

	<description>A small cohesive module, leveraging Java 8 functional capabilities to remove most of the boiler-plate of handling checked exceptions.</description>
	<url>https://unexceptional.earcam.io</url>
	<inceptionYear>2016</inceptionYear>

	<scm>
		<connection>scm:git:ssh://git@bitbucket.org/${coordinate.username.project}.git</connection>
		<developerConnection>scm:git:ssh://git@bitbucket.org/${coordinate.username.project}.git</developerConnection>
		<url>http://bitbucket.org/${coordinate.username.project}.git</url>
		<tag>v1.0.0</tag>
	</scm>
	<issueManagement>
		<system>BitBucket</system>
		<url>https://bitbucket.org/${coordinate.username.project}/issues</url>
	</issueManagement>
	<ciManagement>
		<system>Travis</system>
		<url>https://travis-ci.org/${coordinate.username.project}</url>
	</ciManagement>
	<distributionManagement>
		<site>
			<id>netlify</id>
			<url>https://unexceptional.earcam.io</url>
		</site>
	</distributionManagement>

	<properties>
		<version.java.platform>8</version.java.platform>
		<version.java>1.${version.java.platform}</version.java>

		<maven.compiler.source>${version.java}</maven.compiler.source>
		<maven.compiler.target>${version.java}</maven.compiler.target>

		<coordinate.username.project>earcam/${project.artifactId}</coordinate.username.project>

		<version.junit5>5.2.0</version.junit5>

		<!-- downgraded due to doxia issues -->
		<version.maven.plugin.site>3.6</version.maven.plugin.site>

		<java.home.8>/usr/lib/jvm/java-8-oracle</java.home.8>
		<java.home.9>/usr/lib/jvm/java-9-oracle</java.home.9>
		<java.home.10>/usr/lib/jvm/java-10-oracle</java.home.10>

		<skip.execution.pitest>false</skip.execution.pitest>

		<!-- 
			jacoco's argLine not merged,
			even with 'combine.self="append"', 
			but we can use late binding
		-->
		<surefire.argLine />
		<jpms.surefire.argLine>--add-opens ${project.artifactId}/${project.artifactId}=ALL-UNNAMED</jpms.surefire.argLine>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<version>${version.junit5}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.platform</groupId>
			<artifactId>junit-platform-launcher</artifactId>
			<version>1.2.0</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>${version.junit5}</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>java-hamcrest</artifactId>
			<version>2.0.0.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<inherited>true</inherited>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.codehaus.mojo</groupId>
										<artifactId>build-helper-maven-plugin</artifactId>
										<versionRange>[3,4)</versionRange>
										<goals>
											<goal>add-test-source</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<execute>
											<runOnConfiguration>true</runOnConfiguration>
										</execute>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.revapi</groupId>
					<artifactId>revapi-maven-plugin</artifactId>
					<configuration>
						<analysisConfiguration>
							<revapi.ignore>
								<item>
									<regex>true</regex>
									<code>java.annotation.removed</code>
									<package>${project.groupId}.*</package>
									<justification>Annotations do not form part of the API</justification>
								</item>
							</revapi.ignore>		
						</analysisConfiguration>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>3.0.0</version>
				<executions>
					<execution>
						<id>add-examples-source</id>
						<phase>generate-test-sources</phase>
						<goals>
							<goal>add-test-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>${project.basedir}/src/example/java</source>
							</sources>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<encoding>${project.build.sourceEncoding}</encoding>
					<showDeprecation>true</showDeprecation>
					<showWarnings>true</showWarnings>
					<compilerArgument>-Xlint:all</compilerArgument>
					<jdkToolchain>
						<vendor>oracle</vendor>
						<version>[1.8,9)</version>
					</jdkToolchain>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
				</configuration>
				<executions>
					<execution>
						<id>default-compile</id>
						<configuration>
							<jdkToolchain>
								<vendor>oracle</vendor>
								<version>9</version>
							</jdkToolchain>
							<release>9</release>
						</configuration>
					</execution>
					<execution>
						<id>base-compile</id>
						<goals>
							<goal>compile</goal>
						</goals>
						<configuration>
							<excludes>
								<exclude>module-info.java</exclude>
							</excludes>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>3.5.1</version>
				<extensions>true</extensions>
				<configuration>
					<archive>
						<addMavenDescriptor>true</addMavenDescriptor>
					</archive>
					<supportedProjectTypes>
						<supportedProjectType>jar</supportedProjectType>
					</supportedProjectTypes>
					<instructions>
						<Bundle-Vendor>${project.developers[0].name} - ${project.organization.name}</Bundle-Vendor>
						<Bundle-ContactAddress>${project.organization.url}</Bundle-ContactAddress>
						<Bundle-Description>${project.description}</Bundle-Description>
						<Bundle-DocURL>${project.url}</Bundle-DocURL>
						<Bundle-Category>${project.groupId}</Bundle-Category>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
					</instructions>
				</configuration>
				<executions>
					<execution>
						<id>create-manifest</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>manifest</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.0.2</version>
				<configuration>
					<archive>
						<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
					</archive>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<executions>
					<execution>
						<id>default-test</id>
						<goals>
							<goal>test</goal>
						</goals>
						<configuration>
							<skip>true</skip><!-- the default JDK v8, see comment below -->
						</configuration>
					</execution>
					<!-- 
						surefire doesn't add "target/classes" dir, 
						in fact it strips out any attempt to add, 
						so we're entirely reliant on an integration 
						test verifying the java major version.
					-->
					<!-- <execution> -->
					<!-- 	<id>jdk8-test</id> -->
					<!-- 	<goals> -->
					<!-- 		<goal>test</goal> -->
					<!-- 	</goals> -->
					<!-- 	<configuration> -->
					<!-- 		<jvm>${java.home.8}/bin/java</jvm> -->
					<!-- 		<classesDirectory>${project.build.outputDirectory}</classesDirectory> -->
					<!-- 		<additionalClasspathElements> -->
					<!-- 			<additionalClasspathElement>${project.build.outputDirectory}/</additionalClasspathElement> -->
					<!-- 		</additionalClasspathElements> -->
					<!-- 		<useManifestOnlyJar>false</useManifestOnlyJar> -->
					<!-- 	</configuration> -->
					<!-- </execution> -->
					
					<execution>
						<id>jdk9-test</id>
						<goals>
							<goal>test</goal>
						</goals>
						<configuration>
							<jvm>${java.home.9}/bin/java</jvm>
							<argLine>@{surefire.argLine} ${jpms.surefire.argLine}</argLine>
						</configuration>
					</execution>
					<execution>
						<id>jdk10-test</id>
						<goals>
							<goal>test</goal>
						</goals>
						<configuration>
							<jvm>${java.home.10}/bin/java</jvm>
							<argLine>@{surefire.argLine} ${jpms.surefire.argLine}</argLine>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>
