<?xml version="1.0"?>
<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>nz.net.osnz.parent</groupId>
    <artifactId>central-parent</artifactId>
    <version>5.4</version>
    <packaging>pom</packaging>

	<name>Open Source New Zealand - Central Parent</name>
	<description>
		Packaging parent for OSNZ.NET Maven projects.
		Defines rules for all projects packaging in this github fork.
		The release plugin will need to be overridden for each project so it maintains the correct structure for Github.
	</description>
	<url>https://github.com/OpenSourceNZ/central-parent</url>

	<licenses>
		<license>
			<name>MIT License</name>
			<url>http://www.opensource.org/licenses/mit-license.php</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Kefeng Deng</name>
			<email>deng@51any.com</email>
		</developer>
	</developers>

	<scm>
		<!-- This setting will be replaced by the maven-release-plugin -->
		<url>https://github.com/OpenSourceNZ/central-parent</url>
		<connection>scm:git:git@github.com/OpenSourceNZ/central-parent.git</connection>
		<developerConnection>scm:git:git@github.com:OpenSourceNZ/central-parent.git</developerConnection>
		<tag>central-parent-5.4</tag>
	</scm>

	<properties>
		<java.version>1.7</java.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<repository.release.id>oss-release</repository.release.id>
		<repository.release.url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</repository.release.url>

		<repository.snapshot.id>oss-snapshot</repository.snapshot.id>
		<repository.snapshot.url>https://oss.sonatype.org/content/repositories/snapshots/</repository.snapshot.url>
	</properties>

	<distributionManagement>
		<repository>
			<id>${repository.release.id}</id>
			<name>Release (Staging) Repository</name>
			<url>${repository.release.url}</url>
		</repository>
		<snapshotRepository>
			<id>${repository.snapshot.id}</id>
			<name>Snapshot Repository</name>
			<url>${repository.snapshot.url}</url>
		</snapshotRepository>
	</distributionManagement>

	<profiles>
		<profile>
			<id>sonaytpe</id>
			<activation>
				<property>
					<name>performRelease</name>
					<value>true</value>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>sonatype-oss-release</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-scm-plugin</artifactId>
						<version>1.9.5</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.1</version>
						<!-- Invocation is defined by the release plugin goal set hence no executions -->
						<configuration>
							<rules>
								<requireMavenVersion>
									<version>[3.3.9,)</version>
								</requireMavenVersion>
								<requireReleaseDeps>
									<!--  Don't allow releases with SNAPSHOT deps or parents -->
									<message>No Snapshots Allowed!</message>
									<failWhenParentIsSnapshot>true</failWhenParentIsSnapshot>
									<searchTransitive>true</searchTransitive>
								</requireReleaseDeps>
								<!-- Don't allow accidental inclusion of commons logging or log4j -->
								<bannedDependencies>
									<excludes>
										<exclude>commons-logging</exclude>
										<exclude>commons-logging-api</exclude>
									</excludes>
								</bannedDependencies>
							</rules>
							<fail>true</fail>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<!-- make sure source and javadocs are included in artifacts on release -->
	<build>
		<pluginManagement>
			<plugins>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5.3</version>
					<configuration>
						<mavenExecutorId>forked-path</mavenExecutorId>
						<arguments>-Dbts.release=release -Psonatype-oss-release</arguments>
						<preparationGoals>clean enforcer:enforce verify</preparationGoals>
						<goals>enforcer:enforce deploy</goals>
						<tagBase>release/${project.groupId}/</tagBase>
						<!-- Disable auto push the changes -->
						<pushChanges>false</pushChanges>
						<localCheckout>true</localCheckout>
					</configuration>
				</plugin>

			</plugins>
		</pluginManagement>
	</build>

</project>
