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

	<groupId>io.earcam</groupId>
	<artifactId>io.earcam.maven</artifactId>
	<version>2.0.7</version>

	<packaging>pom</packaging>

	<name>${project.artifactId}</name>
	<description>DRY Maven, parent/root POM and toolchains.xml</description>

	<organization>
		<name>earcam</name>
		<url>http://earcam.io</url>
	</organization>

	<developers>
		<developer>
			<name>Caspar J. MacRae</name>
			<id>earcam</id>
			<timezone>Europe/London</timezone>
			<url>https://ea.rc.am</url>
		</developer>
	</developers>

	<url>http://github.com/earcam/io.earcam.maven</url>
	<inceptionYear>2014</inceptionYear>

	<licenses>
		<license>
			<name>The Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
			<distribution>repo</distribution>
		</license>
		<license>
			<name>BSD 3-Clause License</name>
			<url>https://opensource.org/licenses/BSD-3-Clause</url>
			<distribution>repo</distribution>
		</license>
		<license>
			<name>Eclipse Public License</name>
			<url>https://www.eclipse.org/legal/epl-v10.html</url>
			<distribution>repo</distribution>
		</license>
		<license>
			<name>MIT License</name>
			<url>https://www.opensource.org/licenses/MIT</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:git://github.com/earcam/io.earcam.maven.git</connection>
		<developerConnection>scm:git:ssh://github.com:earcam/io.earcam.maven.git</developerConnection>
		<url>http://github.com/earcam/io.earcam.maven/tree/master</url>
	  <tag>v2.0.7</tag>
	</scm>
	
	<ciManagement>
		<system>Jenkins</system>
		<url>https://travis-ci.org/earcam/io.earcam.maven</url>
	</ciManagement>

	<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.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

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

		<sonar.java.source>${version.java.platform}</sonar.java.source>

		<version.reflow>1.1.1</version.reflow>
		<!-- <version.pitest>1.2.0</version.pitest> --> <!-- analysis failing -->
		<version.pitest>1.2.0</version.pitest>
		<version.jacoco>0.7.9</version.jacoco>
		
		<!-- Stuck on 3.3, can't bump to 3.5.1 due to Reflow Skin, so can't use velocity #include --> 
		<!-- <version.maven.plugin.site>3.6</version.maven.plugin.site> -->
		<version.maven.plugin.site>3.3</version.maven.plugin.site>
		
		<version.min.maven>3.3.9</version.min.maven>

		<skip.execution.pitest>true</skip.execution.pitest>
	</properties>


	<modules>
		<module>io.earcam.maven.pom</module>
		<module>io.earcam.maven.toolchain</module>
	</modules>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-toolchains-plugin</artifactId>
										<versionRange>[1.1,)</versionRange>
										<goals>
											<goal>toolchain</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>2.6</version>
				</plugin>
			
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>2.5.2</version>
				</plugin>
			
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.7</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-toolchains-plugin</artifactId>
					<version>1.1</version>
					<executions>
						<execution>
							<goals>
								<goal>toolchain</goal>
							</goals>
						</execution>
					</executions>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>${version.maven.plugin.site}</version>
					<configuration>
						<inputEncoding>${project.reporting.outputEncoding}</inputEncoding>
						<outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
					</configuration>
					<dependencies>
						<!-- 
						<dependency>
							<groupId>pl.matsuo.maven.skins</groupId>
							<artifactId>msb3-velocity-tools</artifactId>
							<version>0.1.2-SNAPSHOT</version>
						</dependency>
						 -->

 						<dependency>
							<groupId>lt.velykis.maven.skins</groupId>
							<artifactId>reflow-velocity-tools</artifactId>
							<version>${version.reflow}</version>
						</dependency>
						
 						<dependency> 
 							<groupId>org.apache.velocity</groupId> 
 							<artifactId>velocity</artifactId> 
 							<version>1.7</version> 
 						</dependency> 
					</dependencies>
				</plugin>

				<plugin>
					<groupId>com.github.github</groupId>
					<artifactId>site-maven-plugin</artifactId>
					<version>0.12</version>
				</plugin>

				<plugin>
					<groupId>org.revapi</groupId>
					<artifactId>revapi-maven-plugin</artifactId>
					<version>0.9.1</version>
					<configuration>
						<failOnUnresolvedArtifacts>false</failOnUnresolvedArtifacts>
						<failOnUnresolvedDependencies>false</failOnUnresolvedDependencies>
						<analysisConfiguration>
							<revapi.semver.ignore>
								<enabled>true</enabled>
								<versionIncreaseAllows>
									<major>breaking</major>
									<minor>nonBreaking</minor>
									<patch>equivalent</patch>
								</versionIncreaseAllows>
								<passThroughDifferences>
									<item>java.class.nonPublicPartOfAPI</item>
								</passThroughDifferences>
							</revapi.semver.ignore>
						</analysisConfiguration>
					</configuration>
					<dependencies>
						<dependency>
							<groupId>org.revapi</groupId>
							<artifactId>revapi-java</artifactId>
							<version>0.14.0</version>
							<scope>runtime</scope>
						</dependency>
					</dependencies>
				</plugin>
				
				<plugin>
					<groupId>org.jacoco</groupId>
					<artifactId>jacoco-maven-plugin</artifactId>
					<version>${version.jacoco}</version>
				</plugin>
				
				<plugin>
					<groupId>org.pitest</groupId>
					<artifactId>pitest-maven</artifactId>
					<version>${version.pitest}</version>
					<configuration>
						<inScopeClasses>
							<param>io.earcam.*</param>
						</inScopeClasses>
						<targetClasses>
							<param>${project.artifactId}.*</param>
						</targetClasses>
						<targetTests>
							<param>io.earcam.*</param>
						</targetTests>
						<outputFormats>
							<outputFormat>XML</outputFormat>
							<outputFormat>HTML</outputFormat>
						</outputFormats>
					</configuration>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>1.6</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.0.1</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>2.10.4</version>	
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.8.2</version>
					<configuration>
						<deployAtEnd>true</deployAtEnd>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-enforcer-plugin</artifactId>
					<version>1.4.1</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5.3</version>
				</plugin>

				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>1.6.8</version>
				</plugin>

				<plugin>
					<groupId>com.github.s4u.plugins</groupId>
					<artifactId>sitemapxml-maven-plugin</artifactId>
					<version>1.0.0</version>
				</plugin>
			</plugins>		
		</pluginManagement>
	</build>

	<profiles>
		<profile>
			<id>strict</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-toolchains-plugin</artifactId>
					</plugin>
				
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<configuration>
							<rules>
								<banTransitiveDependencies>
									<excludes>
										<exclude>*:*:*:*:test</exclude>
										<exclude>*:*:*:*:system</exclude>
									</excludes>
								</banTransitiveDependencies>
								<!-- <dependencyConvergence /> --> <!-- can't configure dependencyConvergence to ignore test dependencies ... -->
								<requireMavenVersion>
									<version>${version.min.maven}</version>
								</requireMavenVersion>
							</rules>
							<fail>true</fail>
						</configuration>
						<executions>
							<execution>
								<id>enforce-strict</id>
								<goals>
									<goal>enforce</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.revapi</groupId>
						<artifactId>revapi-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>strict-semver</id>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>jdk-oracle</id>
			
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-toolchains-plugin</artifactId>
						<configuration>
							<toolchains>
								<jdk>
									<version>${maven.compiler.target}</version>
									<vendor>oracle</vendor>
								</jdk>
							</toolchains>
						</configuration>
					</plugin>				
				</plugins>
			</build>
		</profile>

		<profile>
			<id>jdk-azul</id>
			
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-toolchains-plugin</artifactId>
						<configuration>
							<toolchains>
								<jdk>
									<version>${maven.compiler.target}</version>
									<vendor>azul</vendor>
								</jdk>
							</toolchains>
						</configuration>
					</plugin>				
				</plugins>
			</build>
		</profile>

		<profile>
			<id>jdk-openjdk</id>
			
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-toolchains-plugin</artifactId>
						<configuration>
							<toolchains>
								<jdk>
									<version>${maven.compiler.target}</version>
									<vendor>openjdk</vendor>
								</jdk>
							</toolchains>
						</configuration>
					</plugin>				
				</plugins>
			</build>
		</profile>

		<profile>
			<id>jdk-ibm</id>
			
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-toolchains-plugin</artifactId>
						<configuration>
							<toolchains>
								<jdk>
									<version>${maven.compiler.target}</version>
									<vendor>ibm</vendor>
								</jdk>
							</toolchains>
						</configuration>
					</plugin>				
				</plugins>
			</build>
		</profile>


		<profile>
			<!-- 
				Because of https://maven.apache.org/guides/mini/guide-configuring-plugins.html#Using_the_reporting_Tag_VS_build_Tag
				We must add revapi plugin to build section such that revapi report can't pick up it's API analyser dependency via pluginManagement
				
				Also issue with PiTest report failing as can't find report in pom packaged module
			-->
			<id>report</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>

			<properties>
				<earcam.profile.report>true</earcam.profile.report>
			</properties>

			<build>
				<plugins>
					<plugin>
						<groupId>org.revapi</groupId>
						<artifactId>revapi-maven-plugin</artifactId>
					</plugin>

					<plugin>
						<groupId>org.pitest</groupId>
						<artifactId>pitest-maven</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>site</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>

			<properties>
				<earcam.profile.site>true</earcam.profile.site>
			</properties>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-active-profiles</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireProperty>
											<property>earcam.profile.analyse</property>
											<regex>^true$</regex>
											<message>Profile "analyse" must be active</message>
										</requireProperty>

										<requireProperty>
											<property>earcam.profile.report</property>
											<regex>^true$</regex>
											<message>Profile "report" must be active</message>
										</requireProperty>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>com.github.s4u.plugins</groupId>
						<artifactId>sitemapxml-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>gen</goal>
								</goals>
								<phase>site</phase>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-site-plugin</artifactId>
						<executions>
							<execution>
								<id>stage</id>
								<goals>
									<goal>site</goal>
									<goal>stage</goal>
								</goals>
								<phase>site</phase>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>


		<profile>
			<id>publish-site</id>
			<!-- requires GitHub credentials, this should be in settings.xml in server section -->
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-active-profiles</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireProperty>
											<property>earcam.profile.site</property>
											<regex>^true$</regex>
											<message>Profile "site" must be active</message>
										</requireProperty>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>
				
					<plugin>
						<groupId>com.github.github</groupId>
						<artifactId>site-maven-plugin</artifactId>
						<configuration>
							<message>Creating site for ${project.artifactId}, ${project.version}</message>
							<server>github</server>
						</configuration>
						<executions>
							<execution>
								<id>github-site</id>
								<goals>
									<goal>site</goal>
								</goals>
								<phase>site-deploy</phase>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	
		<profile>
			<id>analyse</id>
			<!-- required for sonarqube -->
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			
			<properties>
				<sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
				<sonar.pitest.mode>reuseReport</sonar.pitest.mode>
				
				<earcam.profile.analyse>true</earcam.profile.analyse>
			</properties>

			<build>
				<plugins>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
								<configuration>
									<propertyName>surefire.argLine</propertyName>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<argLine>${surefire.argLine} -XX:MaxPermSize=512m</argLine>
						</configuration>
					</plugin>					

					<plugin>
						<groupId>org.pitest</groupId>
						<artifactId>pitest-maven</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>mutationCoverage</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>			
		</profile>	


		<profile>
			<id>distribute</id>
			<!-- requires GPG keypass, this should be in settings.xml in a profile called "signature" -->
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>

			<properties>
				<sonar.sourceEncoding>${project.build.sourceEncoding}</sonar.sourceEncoding>
				<sonar.pitest.mode>reuseReport</sonar.pitest.mode>

				<earcam.profile.distribute>true</earcam.profile.distribute>
			</properties>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-active-profiles</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireProperty>
											<property>earcam.profile.signature</property>
											<regex>^true$</regex>
											<message>Profile "signature" must be active</message>
										</requireProperty>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar</goal>
									<goal>test-jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>jar</goal>
									<goal>test-jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>	
	

		<profile>
			<id>release-scm</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<inherited>true</inherited>
						<executions>
							<execution>
								<id>enforce-no-snapshots</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireReleaseDeps>
											<message>Snapshots dependencies NOT permitted for release</message>
										</requireReleaseDeps>
										<requireReleaseVersion>
											<message>Snapshot version for project NOT permitted for release</message>
										</requireReleaseVersion>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-release-plugin</artifactId>
						<configuration>
							<username>earcam</username>
							<tagNameFormat>v@{project.version}</tagNameFormat>
							<resume>false</resume>
							<pushChanges>false</pushChanges>
							<autoVersionSubmodules>true</autoVersionSubmodules>
							<autoVersionSubmodules>true</autoVersionSubmodules>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>	


		<profile>
			<id>publish</id>
			<!-- requires Sonatype credentials, this should be in settings.xml in server section -->
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>enforce-active-profiles</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireProperty>
											<property>earcam.profile.distribute</property>
											<regex>^true$</regex>
											<message>Profile "distribute" must be active</message>
										</requireProperty>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>
					
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>false</autoReleaseAfterClose>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>	
	</profiles>
</project>