<!--
  ~ Copyright 2012-2023 Oscar Westra van Holthe - Kind
  ~
  ~ 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 https://maven.apache.org/maven-v4_0_0.xsd" child.project.url.inherit.append.path="false">
	<modelVersion>4.0.0</modelVersion>

	<groupId>net.sf.opk</groupId>
	<artifactId>opk-parent</artifactId>
	<version>8</version>
	<packaging>pom</packaging>

	<name>${project.artifactId}</name>
	<description>${project.groupId}:${project.artifactId}</description>
	<url>${project.organization.url}/${project.artifactId}/</url>
	<inceptionYear>2011</inceptionYear>
	<scm child.scm.connection.inherit.append.path="false" child.scm.developerConnection.inherit.append.path="false" child.scm.url.inherit.append.path="false">
		<url>https://github.com/opwvhk/${project.artifactId}</url>
		<developerConnection>scm:git:git@github.com:opwvhk/${project.artifactId}.git</developerConnection>
	  <tag>opk-parent-8</tag>
  </scm>
	<licenses>
		<license>
			<name>Apache-2.0</name>
			<url>https://opensource.org/license/apache-2-0/</url>
			<distribution>repo</distribution>
		</license>
	</licenses>
	<developers>
		<developer>
			<name>Oscar Westra van Holthe - Kind</name>
		</developer>
	</developers>
	<organization>
		<!-- Not really an organization, but the owner of the copyrights. -->
		<name>Oscar Westra van Holthe - Kind</name>
		<url>https://github.com/opwvhk/</url>
	</organization>
	<distributionManagement>
		<snapshotRepository>
			<id>${nexusServerId}</id>
			<url>${nexusUrl}content/repositories/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
	<properties>
		<!-- Build configurations -->
		<maven.compiler.release>17</maven.compiler.release>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
		<!-- Plugin versions -->
		<maven-enforcer-plugin.version>3.3.0</maven-enforcer-plugin.version>
		<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
		<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
		<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
		<maven-gpg-plugin.version>3.0.1</maven-gpg-plugin.version>
		<maven-install-plugin.version>3.1.1</maven-install-plugin.version>
		<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
		<!-- Nexus configuration -->
		<nexusServerId>ossrh</nexusServerId>
		<nexusUrl>https://oss.sonatype.org/</nexusUrl>
		<!--<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>-->
		<nexusAutoReleaseAfterClose>true</nexusAutoReleaseAfterClose>
	</properties>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-enforcer-plugin</artifactId>
					<version>${maven-enforcer-plugin.version}</version>
					<executions>
						<execution>
							<id>enforce-sonatype-oss-requirements</id>
							<goals>
								<goal>enforce</goal>
							</goals>
							<configuration>
								<rules>
									<requireMavenVersion>
										<version>[3.5.4,)</version>
										<message>You need a Maven version at most 5 years old</message>
									</requireMavenVersion>
									<requireJavaVersion>
										<version>11</version>
									</requireJavaVersion>
									<requireReleaseDeps>
										<message>Release versions do not allow snapshot dependencies; they must re reproducible.</message>
										<onlyWhenRelease>true</onlyWhenRelease>
									</requireReleaseDeps>
									<requireUpperBoundDeps />
									<requireFilesExist>
										<message>An OSS project requires a license</message>
										<satisfyAny>true</satisfyAny>
										<files>
											<file>LICENSE</file>
											<file>LICENSE.md</file>
											<file>LICENSE.txt</file>
										</files>
									</requireFilesExist>
									<requireProperty>
										<property>project.groupId</property>
									</requireProperty>
									<requireProperty>
										<property>project.distributionManagement.snapshotRepository.url</property>
										<message>These requirements have been checked for Sonatype deployments only</message>
										<regex>https://(s01\.)?oss\.sonatype\.org/content/repositories/snapshots</regex>
									</requireProperty>
									<requireProperty>
										<property>project.artifactId</property>
									</requireProperty>
									<requireProperty>
										<property>project.version</property>
									</requireProperty>
									<requireProperty>
										<property>project.name</property>
									</requireProperty>
									<requireProperty>
										<property>project.description</property>
									</requireProperty>
									<requireProperty>
										<property>project.url</property>
									</requireProperty>
									<requireProperty>
										<property>project.organization.name</property>
									</requireProperty>
									<requireProperty>
										<property>project.inceptionYear</property>
									</requireProperty>
									<requireProperty>
										<property>project.licenses[0].name</property>
									</requireProperty>
									<requireProperty>
										<property>project.licenses[0].url</property>
									</requireProperty>
									<requireProperty>
										<property>project.scm.developerConnection</property>
									</requireProperty>
								</rules>
								<fail>true</fail>
							</configuration>
						</execution>
						<execution>
							<id>allow-deploy-only-for-release-versions</id>
							<phase>deploy</phase>
							<goals>
								<goal>enforce</goal>
							</goals>
							<configuration>
								<rules combine.self="override">
									<requireReleaseVersion>
										<message>Creating a release requires a release version (not a snapshot).</message>
									</requireReleaseVersion>
								</rules>
							</configuration>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>${maven-compiler-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>${maven-source-plugin.version}</version>
					<executions>
						<execution>
							<id>oss-required-sources</id>
							<goals>
								<goal>jar-no-fork</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>${maven-javadoc-plugin.version}</version>
					<executions>
						<execution>
							<id>oss-required-javadocs</id>
							<goals>
								<goal>jar</goal>
							</goals>
						</execution>
					</executions>
					<configuration combine.children="append">
						<doclint>all,-missing</doclint>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>${maven-gpg-plugin.version}</version>
					<executions>
						<execution>
							<id>sign-artifacts</id>
							<phase>install</phase>
							<goals>
								<goal>sign</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>${maven-install-plugin.version}</version>
					<executions>
						<!--
						To ensure the gpg plugin runs first, we delete the default execution (that always executes first), and recreate it after the gpg plugin.
						This ensures the new execution runs after the gpg plugin execution.

						Can be verified using: mvn fr.jcgay.maven.plugins:buildplan-maven-plugin:list
						-->
						<execution>
							<id>default-install</id>
							<phase>none</phase>
						</execution>
						<execution>
							<id>signed-install</id>
							<goals>
								<goal>install</goal>
							</goals>
						</execution>
					</executions>
				</plugin>
				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>${nexus-staging-maven-plugin.version}</version>
					<extensions>true</extensions>
					<configuration combine.children="append">
						<serverId>${nexusServerId}</serverId>
						<nexusUrl>${nexusUrl}</nexusUrl>
						<autoReleaseAfterClose>${nexusAutoReleaseAfterClose}</autoReleaseAfterClose>
					</configuration>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>3.0.0</version>
					<configuration>
						<scmDevelopmentCommitComment>Next development version</scmDevelopmentCommitComment>
						<scmReleaseCommitComment>Release @{releaseLabel}</scmReleaseCommitComment>
						<pushChanges>true</pushChanges>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
			</plugin>
			<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>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>
</project>
