<!--
  Copyright 2010-2022 Yusef Badri - All rights reserved.
  This POM is distributed under the terms of the GNU Affero General Public License, Version 3 (AGPLv3).
-->
<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.github.greysoft.greybuild</groupId>
	<artifactId>grey-build-common</artifactId>
	<version>2.0.2</version>
	<packaging>pom</packaging>
	<name>Common Build Defs</name>
	<url>https://github.com/greysoft/greybuild</url>
	<description>Root POM with common build defs</description>
	<properties>
		<java.version>1.8</java.version>
		<grey.version.slf4j>1.7.36</grey.version.slf4j>
		<grey.version.commonslog>1.2</grey.version.commonslog>
		<grey.manifest.vendor>Grey Software</grey.manifest.vendor>
		<grey.manifest.builder>Grey Build Manager</grey.manifest.builder>
		<grey.nexus.url>http://localhost:8081</grey.nexus.url>
		<grey.assemblyname>${project.artifactId}</grey.assemblyname>
		<grey.buildid>${maven.build.timestamp}</grey.buildid>
		<maven.build.timestamp.format>yyyyMMddHHmm</maven.build.timestamp.format>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<version>4.7.0</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>flatten-maven-plugin</artifactId>
					<version>1.3.0</version>
					<configuration>
						<updatePomFile>true</updatePomFile>
						<pomElements>
							<dependencyManagement/>
							<dependencies/>
							<name/>
							<url/>
							<scm/>
							<description/>
							<developers/>
						</pomElements>
					</configuration>
					<executions>
						<execution>
							<id>flatten</id>
							<phase>process-resources</phase>
							<goals>
								<goal>flatten</goal>
							</goals>
						</execution>
						<execution>
							<id>flatten.clean</id>
							<phase>clean</phase>
							<goals>
								<goal>clean</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>3.4.2</version>
					<configuration>
						<descriptors>
							<descriptor>src/main/assembly/archive.xml</descriptor>
						</descriptors>
						<finalName>${grey.assemblyname}-${project.version}</finalName>
						<appendAssemblyId>false</appendAssemblyId>
						<tarLongFileMode>posix</tarLongFileMode>
					</configuration>
					<executions>
						<execution>
							<phase>install</phase>
							<goals>
								<goal>single</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<version>3.3.0</version>
					<configuration>
						<!-- serves as input to copy goal - copies current JAR -->
						<artifactItems>
							<artifactItem>
								<groupId>${project.groupId}</groupId>
								<artifactId>${project.artifactId}</artifactId>
								<version>${project.version}</version>
								<type>${project.packaging}</type>
							</artifactItem>
						</artifactItems>
						<!-- prevents copy-dependencies copying unit-test deps -->
						<includeScope>runtime</includeScope>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.2.1</version>
					<executions>
						<execution>
							<id>generate-jar</id>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.4.1</version>
					<executions>
						<execution>
							<id>generate-jar</id>
							<goals>
								<goal>jar</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>3.0.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-shade-plugin</artifactId>
					<version>3.3.0</version>
					<executions>
						<execution>
							<phase>package</phase>
							<goals>
								<goal>shade</goal>
							</goals>
							<configuration>
								<createDependencyReducedPom>false</createDependencyReducedPom>
								<transformers>
									<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
										<mainClass>${grey.manifest.mainclass}</mainClass>
									</transformer>
								</transformers>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.10.1</version>
				<configuration>
					<!-- NB: ${java.specification.version} would specify the current JDK -->
					<source>${java.version}</source>
					<target>${java.version}</target>
					<!-- debug=true (default) implies debuglevel=lines,vars,source and debug=false should mean debuglevel=none
								... but this doesn't work: see issue jira.codehaus.org/browse/MCOMPILER-114
						To override this debug-enabled config and generate the smallest most stripped-down JARs, run as:
							mvn -Dmaven.compiler.debug=true -Dmaven.compiler.debuglevel=none clean install
						Must set debug=true for the debuglevel=none setting to even be acknowledged!
					<debug>true</debug>
					<debuglevel>none</debuglevel>
					-->
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>3.2.2</version>
				<configuration>
					<archive>
						<addMavenDescriptor>false</addMavenDescriptor>
						<manifest>
							<mainClass>${grey.manifest.mainclass}</mainClass>
							<addClasspath>true</addClasspath>
						</manifest>
						<manifestEntries>
							<Built-By>${grey.manifest.builder}</Built-By>
						</manifestEntries>
						<manifestSections>
							<manifestSection>
								<name>${grey.manifest.name}</name>
								<manifestEntries>
									<Sealed>true</Sealed>
									<Specification-Title>"${project.name}"</Specification-Title>
									<Specification-Version>"${project.version}"</Specification-Version>
									<Specification-Vendor>"${grey.manifest.vendor}"</Specification-Vendor>
									<Implementation-Title>"${project.groupId}:${project.artifactId}"</Implementation-Title>
									<Implementation-Version>"${grey.buildid}"</Implementation-Version>
									<Implementation-Vendor>"${grey.manifest.vendor}"</Implementation-Vendor>
								</manifestEntries>
							</manifestSection>
						</manifestSections>
					</archive>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.22.2</version>
				<configuration>
					<useFile>false</useFile> <!-- see output on console -->
					<trimStackTrace>false</trimStackTrace>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.8.8</version>
				<executions>
					<execution>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
					<execution>
						<id>generate-report</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>report</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>mavencentral</id>
			<distributionManagement>
				<repository>
					<!-- requires settings.xml:/settings/servers/server/id=ossrh with username and password elements at same level as id -->
					<id>ossrh</id>
					<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
				</repository>
			</distributionManagement>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
					</plugin>
					<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>
			<!-- requires settings.xml:/settings/servers/server/id=greyrepo with username and password elements at same level as id -->
			<id>greynexus</id>
			<distributionManagement>
				<repository>
					<id>greyrepo</id>
					<url>${grey.nexus.url}/repository/maven-releases</url>
				</repository>
				<snapshotRepository>
					<id>greyrepo</id>
					<url>${grey.nexus.url}/repository/maven-snapshots</url>
				</snapshotRepository>
			</distributionManagement>
			<repositories>
				<repository>
					<id>greyrepo</id>
					<url>${grey.nexus.url}/repository/maven-public</url>
				</repository>
			</repositories>
		</profile>
	</profiles>
	<scm>
		<connection>scm:git:git://github.com/greysoft/greybuild.git</connection>
		<developerConnection>scm:git:ssh://github.com:greysoft/greybuild.git</developerConnection>
		<url>https://github.com/greysoft/greybuild</url>
	</scm>
	<licenses>
		<license>
			<name>GNU Affero General Public License, Version 3 (AGPLv3)</name>
			<url>https://www.gnu.org/licenses/agpl-3.0.en.html</url>
		</license>
	</licenses>
	<developers>
		<developer>
			<name>Yusef Badri</name>
			<organizationUrl>https://github.com/greysoft</organizationUrl>
		</developer>
	</developers>
</project>
