<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2016 mgm technology partners GmbH

    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>com.mgmtp.maven.poms</groupId>
	<artifactId>mgm-oss-parent</artifactId>
	<packaging>pom</packaging>
	<version>15</version>
	<name>mgm Maven OSS Parent POM</name>
	<description>mgm Maven OSS Parent POM</description>

	<organization>
		<name>mgm technology partners GmbH</name>
		<url>http://www.mgm-tp.com</url>
	</organization>

	<url>https://github.com/mgm-tp/mgm-oss-parent</url>

	<scm>
		<connection>scm:git:git://github.com/mgm-tp/mgm-oss-parent.git</connection>
		<developerConnection>scm:git:ssh://git@github.com/mgm-tp/mgm-oss-parent.git</developerConnection>
		<url>https://github.com/mgm-tp/mgm-oss-parent</url>
		<tag>HEAD</tag>
	</scm>

	<distributionManagement>
		<snapshotRepository>
			<id>${repoId}</id>
			<name>snapshots</name>
			<url>${snapshotRepoUrl}</url>
		</snapshotRepository>
		<repository>
			<id>${repoId}</id>
			<name>releases</name>
			<url>${releaseRepoUrl}</url>
		</repository>
	</distributionManagement>

	<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>

	<developers>
		<developer>
			<id>mgm_oss</id>
			<organization>mgm technology partners GmbH</organization>
			<organizationUrl>http://www.mgm-tp.com</organizationUrl>
			<timezone>Europe/Berlin</timezone>
		</developer>
	</developers>

	<prerequisites>
		<maven>3.3</maven>
	</prerequisites>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.jfrog.buildinfo</groupId>
					<artifactId>artifactory-maven-plugin</artifactId>
					<version>2.4.1</version>
					<configuration>
						<publisher>
							<contextUrl>${env.ARTIFACTORY_URL}</contextUrl>
							<username>${env.ARTIFACTORY_USER}</username>
							<password>${env.ARTIFACTORY_PASSWORD}</password>
							<repoKey>maven-releases</repoKey>
							<snapshotRepoKey>maven-snapshots</snapshotRepoKey>
						</publisher>
						<artifactory>
							<includeEnvVars>false</includeEnvVars>
						</artifactory>
						<buildInfo>
							<buildName>${project.groupId}:${project.artifactId}</buildName>
							<buildNumber>${project.version}</buildNumber>
							<buildUrl>${env.BUILD_URL}</buildUrl>
						</buildInfo>
					</configuration>
					<executions>
						<execution>
							<id>build-info</id>
							<goals>
								<goal>publish</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>com.mycila</groupId>
					<artifactId>license-maven-plugin</artifactId>
					<version>2.11</version>
					<configuration>
						<header>${project.build.directory}/maven-shared-archive-resources/META-INF/copyright_header</header>
						<skipExistingHeaders>true</skipExistingHeaders>
						<excludes>
							<exclude>**/*.txt</exclude>
							<exclude>.maven/**</exclude>
							<exclude>README.md</exclude>
							<exclude>LICENSE</exclude>
							<exclude>NOTICE</exclude>
							<exclude>**/*.log</exclude>
						</excludes>
						<mapping>
							<java>SLASHSTAR_STYLE</java>
							<gradle>SLASHSTAR_STYLE</gradle>
							<props>SCRIPT_STYLE</props>
							<scss>SLASHSTAR_STYLE</scss>
							<ts>SLASHSTAR_STYLE</ts>
							<groovy>SLASHSTAR_STYLE</groovy>
						</mapping>
					</configuration>
				</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.5.1</version>
					<configuration>
						<source>1.8</source>
						<target>1.8</target>
						<showDeprecation>true</showDeprecation>
						<showWarnings>true</showWarnings>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.8.2</version>
					<configuration>
						<updateReleaseInfo>true</updateReleaseInfo>
						<retryFailedDeploymentCount>3</retryFailedDeploymentCount>
						<deployAtEnd>${deployAtEnd}</deployAtEnd>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-ear-plugin</artifactId>
					<version>2.10.1</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-ejb-plugin</artifactId>
					<version>2.5.1</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
					</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-install-plugin</artifactId>
					<version>2.5.2</version>
					<configuration>
						<installAtEnd>${installAtEnd}</installAtEnd>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>2.6</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>2.10.3</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
						<links>
							<link>http://docs.oracle.com/javase/7/docs/api/</link>
						</links>
						<bottom><![CDATA[Copyright (c) 2015 mgm technology partners GmbH]]></bottom>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5.3</version>
					<configuration>
						<autoVersionSubmodules>true</autoVersionSubmodules>
						<suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
						<goals>deploy</goals>
						<preparationGoals>verify</preparationGoals>
						<username>${env.SCM_USER}</username>
						<password>${env.SCM_PASSWORD}</password>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>2.7</version>
					<configuration>
						<delimiters>
							<delimiter>${*}</delimiter>
						</delimiters>
						<useDefaultDelimiters>false</useDefaultDelimiters>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.5</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.0.0</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.19.1</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>2.6</version>
					<configuration>
						<archive>
							<manifest>
								<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
								<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							</manifest>
							<manifestEntries>
								<Implementation-Date>${timestamp}</Implementation-Date>
								<Implementation-Revision>${revision}</Implementation-Revision>
							</manifestEntries>
						</archive>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>buildnumber-maven-plugin</artifactId>
					<version>1.4</version>
				</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-remote-resources-plugin</artifactId>
					<version>1.5</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-scm-plugin</artifactId>
					<version>1.9.4</version>
					<configuration>
						<username>${env.SCM_USER}</username>
						<password>${env.SCM_PASSWORD}</password>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>versions-maven-plugin</artifactId>
					<version>2.2</version>
				</plugin>
				<plugin>
					<groupId>org.codehaus.gmavenplus</groupId>
					<artifactId>gmavenplus-plugin</artifactId>
					<version>1.5</version>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>buildnumber-maven-plugin</artifactId>
				<configuration>
					<buildNumberPropertyName>revision</buildNumberPropertyName>
					<timestampPropertyName>timestamp</timestampPropertyName>
					<timestampFormat>{0,date,yyyy-MM-dd'T'HH:mm:ssZZ}</timestampFormat>
					<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
					<shortRevisionLength>7</shortRevisionLength>
					<providerImplementations>
						<svn>svn</svn>
					</providerImplementations>
					<username>${env.SCM_USER}</username>
					<password>${env.SCM_PASSWORD}</password>
				</configuration>
				<executions>
					<execution>
						<id>create-build-metadata</id>
						<phase>validate</phase>
						<goals>
							<goal>create</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-maven</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireMavenVersion>
									<version>3</version>
								</requireMavenVersion>
							</rules>
						</configuration>
					</execution>
					<execution>
						<id>enforce-plugin-versions</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requirePluginVersions>
									<message>Versions for all plugins must be defined in pom.xml!</message>
								</requirePluginVersions>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>attachJavadocs</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>signArtifacts</id>
			<build>
				<plugins>
					<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>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>attachSources</id>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>source-jar</id>
								<phase>package</phase>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>sonar</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<version>0.7.6.201602180812</version>
						<executions>
							<execution>
								<id>prepare-jacoco-agent</id>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
								<configuration>
									<destFile>${sonar.jacoco.reportPath}</destFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
			<properties>
				<sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
				<sonar.jacoco.reportPath>${project.build.directory}/jacoco-unit.exec</sonar.jacoco.reportPath>
				<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
			</properties>
		</profile>
		<profile>
			<id>include-license</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-remote-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>include-license-resources</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>process</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<resourceBundles>
								<resourceBundle>${license.bundle}</resourceBundle>
							</resourceBundles>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>copy-license-files</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-license-files-to-basedir</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<resources>
										<resource>
											<directory>${project.build.directory}/maven-shared-archive-resources/META-INF</directory>
											<filtering>false</filtering>
											<includes>
												<include>LICENSE</include>
												<include>NOTICE</include>
											</includes>
										</resource>
									</resources>
									<outputDirectory>${basedir}</outputDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>add-license-headers</id>
			<build>
				<plugins>
					<plugin>
						<groupId>com.mycila</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>add-license</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>format</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>check-license-headers</id>
			<build>
				<plugins>
					<plugin>
						<groupId>com.mycila</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>check-license</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>remove-license-headers</id>
			<build>
				<plugins>
					<plugin>
						<groupId>com.mycila</groupId>
						<artifactId>license-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>remove-license</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>remove</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>ban-snapshots</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<executions>
							<execution>
								<id>ban-snapshots</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireReleaseDeps>
											<message>Snapshot dependencies are not allowed!</message>
										</requireReleaseDeps>
										<requireReleaseVersion>
											<message>Snapshot version not allowed!</message>
										</requireReleaseVersion>
									</rules>
									<fail>true</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>update-versions</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.gmavenplus</groupId>
						<artifactId>gmavenplus-plugin</artifactId>
						<executions>
							<execution>
								<id>next-snapshot</id>
								<phase>validate</phase>
								<goals>
									<goal>execute</goal>
								</goals>
								<configuration>
									<properties>
										<versionType>${version.type}</versionType>
										<nextVersion>${nextVersion}</nextVersion>
										<appendJenkinsBuildNumber>${appendJenkinsBuildNumber}</appendJenkinsBuildNumber>
									</properties>
									<scripts>
										<script>
											<![CDATA[
												import org.apache.maven.shared.release.versions.VersionInfo
												import org.apache.maven.shared.release.versions.DefaultVersionInfo
												
												VersionInfo versionInfo = new DefaultVersionInfo(project.version)
												if (nextVersion) {
													log.info 'Using new version from property'
												} else {
													versionType = versionType ?: 'snapshot'
													log.info "Version type for new version: $versionType"
													if ('release'.equals(versionType)) {
														def relVersion = versionInfo.getReleaseVersionString()
														nextVersion = appendJenkinsBuildNumber ? relVersion + '-' + System.getenv().'BUILD_NUMBER' : relVersion
													} else {
														nextVersion = versionInfo.getNextVersion().getSnapshotVersionString()
													}
												}

												// set property for versions plugin
												project.properties['newVersion'] = nextVersion

												log.info "Next version: $nextVersion"
												new File('.ci-version').write(nextVersion)
											]]>
										</script>
									</scripts>
								</configuration>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.codehaus.groovy</groupId>
								<artifactId>groovy-all</artifactId>
								<version>${update-versions.groovy.version}</version>
								<scope>runtime</scope>
							</dependency>
							<dependency>
								<groupId>org.apache.maven.release</groupId>
								<artifactId>maven-release-manager</artifactId>
								<version>2.5.2</version>
							</dependency>
						</dependencies>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>versions-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>set-new-version</id>
								<phase>validate</phase>
								<goals>
									<goal>set</goal>
								</goals>
							</execution>
						</executions>
						<configuration>
							<generateBackupPoms>false</generateBackupPoms>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>buildinfo</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jfrog.buildinfo</groupId>
						<artifactId>artifactory-maven-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
			<properties>
				<installAtEnd>false</installAtEnd>
			</properties>
		</profile>
		<profile>
			<id>staging</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jfrog.buildinfo</groupId>
						<artifactId>artifactory-maven-plugin</artifactId>
						<configuration>
							<publisher>
								<repoKey>maven-staging</repoKey>
							</publisher>
						</configuration>
					</plugin>
				</plugins>
			</build>
			<properties>
				<installAtEnd>false</installAtEnd>
			</properties>
		</profile>
	</profiles>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<license.bundle>com.mgmtp.maven.resources:mgm-oss-jar-resource-bundle:2</license.bundle>
		<update-versions.groovy.version>2.4.3</update-versions.groovy.version>
		<installAtEnd>true</installAtEnd>
		<deployAtEnd>true</deployAtEnd>
	</properties>
</project>
