<?xml version="1.0" encoding="UTF-8"?>
<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>
	<parent>
		<groupId>org.sonatype.oss</groupId>
		<artifactId>oss-parent</artifactId>
		<version>9</version>
	</parent>
	<groupId>com.github.cowwoc.requirements</groupId>
	<artifactId>root</artifactId>
	<version>6.0.1</version>
	<packaging>pom</packaging>
	<name>Requirements</name>
	<description>A fluent API for enforcing design contracts with automatic message generation</description>
	<url>https://github.com/cowwoc/requirements.java/</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>

	<scm>
		<url>https://github.com/cowwoc/requirements.java/</url>
		<connection>scm:git:https://github.com/cowwoc/requirements.java/</connection>
		<developerConnection>scm:git:https://github.com/cowwoc/requirements.java/</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<developers>
		<developer>
			<id>cowwoc</id>
			<name>Gili Tzabari</name>
			<email>cowwoc2020@gmail.com</email>
		</developer>
	</developers>

	<modules>
		<module>annotations</module>
		<module>natives</module>
		<module>java</module>
		<module>guava</module>
		<module>code_generator</module>
		<module>maven_plugin</module>
	</modules>

	<build>
		<pluginManagement>
			<plugins>
				<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>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.8.0</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.1.0</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-gpg-plugin</artifactId>
					<version>1.6</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.22.1</version>
				</plugin>
				<plugin>
					<artifactId>maven-antrun-plugin</artifactId>
					<version>1.8</version>
				</plugin>
				<plugin>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.1.0</version>
				</plugin>
				<plugin>
					<artifactId>maven-deploy-plugin</artifactId>
					<version>2.8.2</version>
				</plugin>
				<plugin>
					<artifactId>maven-install-plugin</artifactId>
					<version>2.5.2</version>
				</plugin>
				<plugin>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.7.1</version>
				</plugin>
				<plugin>
					<artifactId>maven-jar-plugin</artifactId>
					<version>3.1.1</version>
				</plugin>
				<plugin>
					<artifactId>maven-resources-plugin</artifactId>
					<version>3.1.0</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>license-maven-plugin</artifactId>
					<version>2.0.0</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<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>${maven.version}</version>
								</requireMavenVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<configuration>
					<autoVersionSubmodules>true</autoVersionSubmodules>
					<tagNameFormat>release-@{project.version}</tagNameFormat>
				</configuration>
			</plugin>
			<plugin>
				<!--
				Cannot be hidden behind the "deploy" profile because we invoke "rc-open" and "rc-close" before and
				after the deploy.
				-->
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<serverId>sonatype-nexus-staging</serverId>
					<nexusUrl>https://oss.sonatype.org/</nexusUrl>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<showWarnings>true</showWarnings>
					<showDeprecation>true</showDeprecation>
					<compilerArgs>
						<arg>-Xdiags:verbose</arg>
						<arg>-Werror</arg>
					</compilerArgs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<id>default-cli</id>
						<goals>
							<goal>aggregate</goal>
						</goals>
						<!-- Reminder: Use "-pl !test,!benchmark" to exclude test modules -->
						<configuration>
							<show>public</show>
							<additionalOptions>
								<!--
								Maven plugins cannot be full-fledged modules due to Maven's use of split packages.
								automatic-modules are treated as unnamed modules so we need to explicitly export packages
								to them.
								-->
								<option>--add-modules</option>
								<option>java.xml</option>
								<!-- https://stackoverflow.com/a/54468139/14731 -->
								<option>--override-methods</option>
								<option>summary</option>
							</additionalOptions>
							<links>
								<link>https://guava.dev/releases/${guava.version}/api/docs/</link>
							</links>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>license-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>3rd-party-licenses</id>
						<goals>
							<goal>aggregate-add-third-party</goal>
						</goals>
						<phase>process-sources</phase>
						<configuration>
							<missingFile>3rd-party-licenses.txt</missingFile>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.release>11</maven.compiler.release>
		<maven.version>3.6.1</maven.version>
		<guava.version>28.1-jre</guava.version>
		<slf4j.version>1.8.0-beta4</slf4j.version>
		<logback.version>1.3.0-alpha4</logback.version>
		<testng.version>7.0.0</testng.version>
		<pouch.version>2.1</pouch.version>
		<jmh.version>1.21</jmh.version>
		<java.parser.version>3.15.0</java.parser.version>
	</properties>
	<profiles>
		<profile>
			<id>list-profiles</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<phase>validate</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<tasks>
										<echo>Please pick one of the following profiles:</echo>
										<echo>* windows-x86_64-debug</echo>
										<echo>* windows-x86_64-release</echo>
										<echo>* linux-x86_64-debug</echo>
										<echo>* linux-x86_64-release</echo>
										<echo>* mac-x86_64-debug</echo>
										<echo>* mac-x86_64-release</echo>
										<echo/>
										<echo>For instance: mvn -Pwindows-x86_64-debug install</echo>
										<fail/>
									</tasks>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>windows-x86_64-debug</id>
			<properties>
				<platform>windows-x86_64</platform>
				<build.type>debug</build.type>
			</properties>
		</profile>
		<profile>
			<id>windows-x86_64-release</id>
			<activation>
				<os>
					<family>windows</family>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<platform>windows-x86_64</platform>
				<build.type>release</build.type>
			</properties>
		</profile>
		<profile>
			<id>linux-x86_64-debug</id>
			<properties>
				<platform>linux-x86_64</platform>
				<build.type>debug</build.type>
			</properties>
		</profile>
		<profile>
			<id>linux-x86_64-release</id>
			<activation>
				<os>
					<family>linux</family>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<platform>linux-x86_64</platform>
				<build.type>release</build.type>
			</properties>
		</profile>
		<profile>
			<id>mac-x86_64-debug</id>
			<properties>
				<platform>mac-x86_64</platform>
				<build.type>debug</build.type>
			</properties>
		</profile>
		<profile>
			<id>mac-x86_64-release</id>
			<activation>
				<os>
					<family>mac</family>
					<arch>x86_64</arch>
				</os>
			</activation>
			<properties>
				<platform>mac-x86_64</platform>
				<build.type>release</build.type>
			</properties>
		</profile>
		<profile>
			<id>deploy</id>
			<!--
			Must use property-based activation because there is no way to activate no-deploy profile without it.
			See https://stackoverflow.com/a/7481347/14731
			-->
			<activation>
				<property>
					<name>deploy</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-javadoc-plugin</artifactId>
						<!-- pluginManagement does not override version used by org.sonatype.oss:oss-parent -->
						<version>3.1.0</version>
					</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>
								<configuration>
									<!-- See https://maven.apache.org/guides/mini/guide-encryption.html -->
									<passphraseServerId>gpg.passphrase</passphraseServerId>
									<!-- See https://stackoverflow.com/a/53992951/14731 -->
									<gpgArguments>
										<arg>--pinentry-mode</arg>
										<arg>loopback</arg>
									</gpgArguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>no-deploy</id>
			<!--
			According to https://github.com/sonatype/nexus-maven-plugins/tree/master/staging/maven-plugin
			skipNexusStagingDeployMojo may not be set to true in the last reactor module. Because we don't
			want to deploy our last module, nor a dummy module, we simply omit the relevant modules when
			a deploy is in progress.
			-->
			<activation>
				<property>
					<name>!deploy</name>
				</property>
			</activation>
			<modules>
				<module>generated_api</module>
				<module>test</module>
				<module>benchmark</module>
				<module>wiki</module>
			</modules>
		</profile>
	</profiles>
</project>
