<?xml version="1.0" encoding="UTF-8"?>
<!--
	Copyright 2018 Black Pepper Software

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

	    http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
-->

<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/maven-v4_0_0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>uk.co.blackpepper</groupId>
	<artifactId>bp-parent</artifactId>
	<packaging>pom</packaging>
	<version>1.4.0</version>
	
	<name>Black Pepper Parent</name>
	<description>Parent POM for Black Pepper projects.</description>
	<url>https://github.com/BlackPepperSoftware/bp-parent</url>
	
	<licenses>
	
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	
	</licenses>
	
	<organization>
		<name>Black Pepper Software</name>
		<url>http://www.blackpepper.co.uk/</url>
	</organization>
	
	<developers>
	
		<developer>
			<id>mark.hobson</id>
			<name>Mark Hobson</name>
			<email>mark.hobson@blackpepper.co.uk</email>
			<organization>Black Pepper Software</organization>
			<organizationUrl>http://www.blackpepper.co.uk/</organizationUrl>
		</developer>

		<developer>
			<id>john.eccleston</id>
			<name>John Eccleston</name>
			<email>john.eccleston@blackpepper.co.uk</email>
			<organization>Black Pepper Software</organization>
			<organizationUrl>http://www.blackpepper.co.uk/</organizationUrl>
		</developer>
		
	</developers>
	
	<issueManagement>
		<system>GitHub</system>
		<url>https://github.com/BlackPepperSoftware/bp-parent/issues</url>
	</issueManagement>
	
	<ciManagement>
		<system>Travis CI</system>
		<url>https://travis-ci.org/BlackPepperSoftware/bp-parent</url>
	</ciManagement>
	
	<scm>
		<connection>scm:git:git@github.com:BlackPepperSoftware/bp-parent.git</connection>
		<developerConnection>scm:git:git@github.com:BlackPepperSoftware/bp-parent.git</developerConnection>
		<tag>1.4.0</tag>
		<url>https://github.com/BlackPepperSoftware/bp-parent</url>
	</scm>
	
	<properties>
	
		<!-- Encoding -->
		
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		
		<!-- Plugin versions -->
		
		<jettyVersion>9.0.6.v20130930</jettyVersion>
		
		<!-- Dependency versions -->
		
		<bpBuildVersion>1.2.0</bpBuildVersion>

	</properties>
	
	<build>
	
		<pluginManagement>
		
			<plugins>
			
				<!-- Maven -->
			
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-checkstyle-plugin</artifactId>
					<version>2.17</version>
					<configuration>
						<configLocation>checkstyle.xml</configLocation>
						<includeTestSourceDirectory>true</includeTestSourceDirectory>
						<consoleOutput>true</consoleOutput>
					</configuration>
					<dependencies>
						<dependency>
							<groupId>com.puppycrawl.tools</groupId>
							<artifactId>checkstyle</artifactId>
							<version>8.2</version>
						</dependency>
						<dependency>
							<groupId>uk.co.blackpepper</groupId>
							<artifactId>bp-build</artifactId>
							<version>${bpBuildVersion}</version>
						</dependency>
					</dependencies>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.0.0</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.1</version>
					<configuration>
						<source>1.8</source>
						<target>1.8</target>
					</configuration>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<version>2.10</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.8.2</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-enforcer-plugin</artifactId>
					<version>1.4</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-failsafe-plugin</artifactId>
					<version>2.19</version>
				</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-install-plugin</artifactId>
					<version>2.5.2</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>3.0.2</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-release-plugin</artifactId>
					<version>2.5.3</version>
					<configuration>
						<tagNameFormat>@{project.version}</tagNameFormat>
					</configuration>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>3.0.1</version>
				</plugin>
				
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.5.1</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-surefire-plugin</artifactId>
					<version>2.19</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				
				<!-- Sonatype -->
				
				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>1.6.8</version>
					<configuration>
						<serverId>sonatype-nexus-staging</serverId>
						<nexusUrl>https://oss.sonatype.org/</nexusUrl>
						<autoReleaseAfterClose>true</autoReleaseAfterClose>
					</configuration>
				</plugin>

				<!-- Codehaus -->
				
				<plugin>
					<groupId>org.codehaus.cargo</groupId>
					<artifactId>cargo-maven2-plugin</artifactId>
					<version>1.4.5</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>build-helper-maven-plugin</artifactId>
					<version>3.0.0</version>
				</plugin>

				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>buildnumber-maven-plugin</artifactId>
					<version>1.2</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>cobertura-maven-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>exec-maven-plugin</artifactId>
					<version>1.5.0</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>findbugs-maven-plugin</artifactId>
					<version>2.5.4</version>
					<configuration>
						<includeTests>true</includeTests>
					</configuration>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>properties-maven-plugin</artifactId>
					<version>1.0-alpha-2</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>selenium-maven-plugin</artifactId>
					<version>2.3</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>sql-maven-plugin</artifactId>
					<version>1.5</version>
				</plugin>
				
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>versions-maven-plugin</artifactId>
					<version>2.2</version>
				</plugin>
				
				<!-- Eclipse -->
				
				<plugin>
					<groupId>org.eclipse.jetty</groupId>
					<artifactId>jetty-maven-plugin</artifactId>
					<version>${jettyVersion}</version>
					<configuration>
						<reload>manual</reload>
					</configuration>
				</plugin>
				
				<!-- JaCoCo -->
				
				<plugin>
					<groupId>org.jacoco</groupId>
					<artifactId>jacoco-maven-plugin</artifactId>
					<version>0.8.2</version>
				</plugin>
				
				<!-- Mycila -->
				
				<plugin>
					<groupId>com.mycila</groupId>
					<artifactId>license-maven-plugin</artifactId>
					<version>2.11</version>
					<configuration>
						<header>header.txt</header>
						<headerDefinitions>
							<headerDefinition>headerDefinitions.xml</headerDefinition>
						</headerDefinitions>
						<properties>
							<owner>${project.organization.name}</owner>
						</properties>
						<excludes>
							<exclude>.checkstyle</exclude>
							<exclude>LICENSE</exclude>
						</excludes>
						<mapping>
							<java>JAVA_STYLE</java>
						</mapping>
					</configuration>
					<dependencies>
						<dependency>
							<groupId>uk.co.blackpepper</groupId>
							<artifactId>bp-build</artifactId>
							<version>${bpBuildVersion}</version>
						</dependency>
					</dependencies>
				</plugin>
				
				<!-- Less -->
				
				<plugin>
					<groupId>org.lesscss</groupId>
					<artifactId>lesscss-maven-plugin</artifactId>
					<version>1.7.0.1.1</version>
				</plugin>

			</plugins>
		
		</pluginManagement>
		
		<plugins>
		
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireJavaVersion>
									<version>1.8.0</version>
								</requireJavaVersion>
								<requireMavenVersion>
									<version>3.2.0</version>
								</requireMavenVersion>
								<requireNoRepositories />
								<requirePluginVersions />
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<extensions>true</extensions>
			</plugin>
			
		</plugins>
	
	</build>
	
	<profiles>
	
		<profile>
			<id>qa</id>
			<activation>
				<property>
					<name>!skipQA</name>
				</property>
			</activation>
			<build>
				<plugins>
				
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					
					<!-- TODO: reinstate when BPB-4 fixed -->
					<!-- <plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>findbugs-maven-plugin</artifactId>
						<executions>
							<execution>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin> -->
					
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>default-prepare-agent</id>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
							</execution>
							<execution>
								<id>default-check</id>
								<goals>
									<goal>check</goal>
								</goals>
								<configuration>
									<rules>
										<rule>
											<element>BUNDLE</element>
											<limits>
												<limit>
													<counter>COMPLEXITY</counter>
													<value>COVEREDRATIO</value>
													<minimum>0.70</minimum>
												</limit>
											</limits>
										</rule>
									</rules>
								</configuration>
							</execution>
						</executions>
					</plugin>
					
				</plugins>
			</build>
		</profile>
	
		<profile>
			<id>release</id>
			<activation>
				<property>
					<name>performRelease</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<id>sign</id>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		
		<profile>
			<id>nonRelease</id>
			<!--
				Disable deploy of "release-versioned" builds, *unless build is as a result of
				maven-release-plugin*.
				
				This prevents Travis CI attempting to deploy an artifact with a non-snapshot
				version. This deploy will have already occurred as a result of the developer's
				release (performed locally.)
				
				Note that this profile will be activated whenever the release plugin is *not*
				used, and the skip deploy property will then be set whenever the project version
				is *not* a snapshot.
			-->
			<activation>
				<property>
					<name>!performRelease</name>
				</property>
			</activation>
			<properties>
				<skipNexusStagingDeployMojo>${isReleaseVersion}</skipNexusStagingDeployMojo>
			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>determine-build-type</id>
								<!--
									Set isReleaseVersion to "true" if project version *does not*
									end in "-SNAPSHOT".
									
									If the project version *does* end in "-SNAPSHOT", isReleaseVersion
									will instead equal the project version. Deploy will therefore be
									skipped.
								-->
								<goals>
									<goal>regex-property</goal>
								</goals>
								<configuration>
									<name>isReleaseVersion</name>
									<value>${project.version}</value>
									<regex>^(?!.*-SNAPSHOT$).*$</regex>
									<replacement>true</replacement>
									<failIfNoMatch>false</failIfNoMatch>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>
	
	<distributionManagement>
	
		<repository>
			<id>sonatype-nexus-staging</id>
			<name>Sonatype Nexus Staging Repository</name>
			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
		</repository>
	
		<snapshotRepository>
			<id>sonatype-nexus-snapshots</id>
			<name>Sonatype Nexus Snapshot Repository</name>
			<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
		</snapshotRepository>
	
	</distributionManagement>
	
</project>
