<?xml version="1.0" encoding="UTF-8"?>
<!--
GlobalMentor, Inc. Root POM
Copyright © 2018-2022 GlobalMentor, Inc. (https://www.globalmentor.com/)

## Properties

### Generated Properties
`project.releaseVersion`
: Set to the version to use for release, without any qualifiers, as per [Semantic Versioning 2.0.0 Item 9](https://semver.org/#spec-item-9).
  For example, both `1.2.3-SNAPSHOT` and `1.2.3-beta.4` yield a release version of `1.2.3`.
`build.year`
: Set to the year in which the project was built, in UTC; a string in the format `YYYY`. 
`build.date`
: Set to the date on which the project was built, in UTC; a string in the format `YYYY-MM-DD`.
`build.timestamp`
: Set to the date and time at which the project was built, in UTC; a string in the format `YYYY-MM-DDTHH:MM:SSZ`.
`assemblyDirectory`
: The temporary build directory for assembly descriptors; defaults to `${project.build.directory}/assembly`

### Configurable Properties
`binSourceDirectory`
: The source directory for scripts; defaults to `${project.basedir}/src/bin`.
`binOutputDirectory`
: The output directory for scripts; defaults to `${project.build.directory}/bin`
`exe.main.class`
: The full class name of the class containing the `main()` method for an executable JAR; no default.
  This property also functions as a flag to create an an executable JAR, create a Linux executable
  script from the executable JAR, generate a Windows executable, and if the `publish` profile is
  in effect produce a "bin" archive with the executable files during the `package` phase.
`exe.base.filename`
: The base filename (e.g. `my-cli`) of any generated executable script or program; defaults to `${project.artifactId}`.
`exe.filename`
: The filename of any generated Windows executable; defaults to `${exe.base.filename}.exe`.
`nexus.host`
: The hostname of the Nexus server for publishing artifacts.

### Internal Properties
`_exe.main.classAsAbsolutePath`
: If `exe.base.filename` defined, set to the absolute path form of the class; e.g. `com.example.MainClass` becomes `/com/example/MainClass`. 
`_isSkipGenerateExe`
: Set to `false` if `${exe.base.filename}` is defined; otherwise set to `true`.
  This property is used to skip exe-related plugin executions.

## Scripts

To copy and process scripts, simply include the scripts in `src/bin` and they will be detected automatically
and the `prepare-bin-files` profile activated. The scripts will be included in any `bin` distributable.

Note that under the current implementaiton, the `bin` distributable will only be created if an `${exe.main.class}`
is specified.
```

The executable JAR will automatically be copied into the same directory in the same phase as a *nix executable script
as long as the `exe.main.class` has been defined.
 -->
<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>

	<groupId>com.globalmentor</groupId>
	<artifactId>globalmentor-root</artifactId>
	<version>0.8.14</version>
	<packaging>pom</packaging>

	<name>GlobalMentor Root</name>
	<description>GlobalMentor root POM.</description>
	<url>https://www.globalmentor.com/software/</url>

	<organization>
		<name>GlobalMentor, Inc.</name>
		<url>https://www.globalmentor.com/</url>
	</organization>

	<developers>
		<developer>
			<name>Garret Wilson</name>
			<email>garret@globalmentor.com</email>
			<organization>GlobalMentor, Inc.</organization>
			<organizationUrl>https://www.globalmentor.com/</organizationUrl>
		</developer>
	</developers>

	<licenses>
		<license>
			<name>Apache-2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<connection>scm:git:https://bitbucket.org/globalmentor/globalmentor-root.git</connection>
		<developerConnection>scm:git:https://bitbucket.org/globalmentor/globalmentor-root.git</developerConnection>
		<url>https://bitbucket.org/globalmentor/globalmentor-root</url>
	</scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.release>8</maven.compiler.release> <!-- JDK 9+ required to build -->
		<gpg.keyname>software@globalmentor.com</gpg.keyname>
		<mockito.version>4.8.1</mockito.version>
		<junit.version>5.9.1</junit.version>
		<hamcrest.version>2.2</hamcrest.version>
		<slf4j.version>2.0.3</slf4j.version>
		<logback.version>1.4.4</logback.version>
		<assemblyDirectory>${project.build.directory}/assembly</assemblyDirectory>
		<binSourceDirectory>${project.basedir}/src/bin</binSourceDirectory>
		<binOutputDirectory>${project.build.directory}/bin</binOutputDirectory>
		<!--
			Set to generate executable JAR, exe file, and distributables.
			<exe.main.class>com.example.cli.Example</exe.main.class>
		-->
		<exe.base.filename>${project.artifactId}</exe.base.filename>
		<exe.filename>${exe.base.filename}.exe</exe.filename>
		<nexus.host>s01.oss.sonatype.org</nexus.host>
		<_xml.cdata.begin>&lt;![CDATA[</_xml.cdata.begin>
		<_xml.cdata.end>]]&gt;</_xml.cdata.end>
	</properties>

	<dependencies>
		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>jsr305</artifactId>
			<optional>true</optional>
		</dependency>

		<!-- test scope dependencies -->

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.hamcrest</groupId>
			<artifactId>hamcrest</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.github.npathai</groupId>
			<artifactId>hamcrest-optional</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.github.npathai</groupId>
				<artifactId>hamcrest-optional</artifactId>
				<version>2.0.0</version>
			</dependency>

			<dependency>
				<groupId>com.google.code.findbugs</groupId>
				<artifactId>jsr305</artifactId>
				<version>3.0.2</version>
			</dependency>

			<dependency>
				<groupId>org.junit.jupiter</groupId>
				<artifactId>junit-jupiter-engine</artifactId>
				<version>${junit.version}</version>
			</dependency>

			<dependency>
				<groupId>org.hamcrest</groupId>
				<artifactId>hamcrest</artifactId>
				<version>${hamcrest.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-api</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>slf4j-simple</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>jcl-over-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>log4j-over-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>jul-to-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>org.slf4j</groupId>
				<artifactId>osgi-over-slf4j</artifactId>
				<version>${slf4j.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-access</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-classic</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-core</artifactId>
				<version>${logback.version}</version>
			</dependency>

			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-core</artifactId>
				<version>${mockito.version}</version>
			</dependency>

			<dependency>
				<groupId>org.mockito</groupId>
				<artifactId>mockito-inline</artifactId>
				<version>${mockito.version}</version>
			</dependency>

			<dependency>
				<groupId>org.zalando</groupId>
				<artifactId>faux-pas</artifactId>
				<version>0.9.0</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>com.akathist.maven.plugins.launch4j</groupId>
					<artifactId>launch4j-maven-plugin</artifactId>
					<version>2.1.3</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<version>3.1.0</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>3.4.2</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>3.2.0</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-compiler-plugin</artifactId>
					<version>3.10.1</version>
					<configuration>
						<showDeprecation>true</showDeprecation>
						<showWarnings>true</showWarnings>
						<compilerArgs>
							<arg>-Xlint:all</arg>
						</compilerArgs>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-dependency-plugin</artifactId>
					<version>3.3.0</version>
				</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-enforcer-plugin</artifactId>
					<version>3.1.0</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-failsafe-plugin</artifactId>
					<version>2.22.2</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-help-plugin</artifactId>
					<version>3.3.0</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-gpg-plugin</artifactId>
					<version>3.0.1</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-install-plugin</artifactId>
					<version>3.0.1</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-jar-plugin</artifactId>
					<version>3.2.2</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-javadoc-plugin</artifactId>
					<version>3.4.1</version>
					<configuration>
						<quiet>true</quiet>
						<detectOfflineLinks>false</detectOfflineLinks>
						<tags>
							<tag>
								<name>apiNote</name>
								<placement>a</placement>
								<head>API Note:</head>
							</tag>
							<tag>
								<name>implSpec</name>
								<placement>a</placement>
								<head>Implementation Specification:</head>
							</tag>
							<tag>
								<name>implNote</name>
								<placement>a</placement>
								<head>Implementation Note:</head>
							</tag>
							<tag>
								<name>param</name>
							</tag>
							<tag>
								<name>return</name>
							</tag>
							<tag>
								<name>throws</name>
							</tag>
							<tag>
								<name>since</name>
							</tag>
							<tag>
								<name>version</name>
							</tag>
							<tag>
								<name>serialData</name>
							</tag>
							<tag>
								<name>see</name>
							</tag>
						</tags>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-release-plugin</artifactId>
					<version>2.5.3</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-resources-plugin</artifactId>
					<version>3.3.0</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-site-plugin</artifactId>
					<version>3.12.1</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-source-plugin</artifactId>
					<version>3.2.1</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-surefire-plugin</artifactId>
					<version>2.22.2</version>
				</plugin>

				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>3.3.2</version>
				</plugin>

				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>build-helper-maven-plugin</artifactId>
					<version>3.3.0</version>
				</plugin>

				<plugin>
					<groupId>org.codehaus.mojo</groupId>
					<artifactId>versions-maven-plugin</artifactId>
					<version>2.12.0</version>
				</plugin>

				<plugin>
					<groupId>org.sonatype.plugins</groupId>
					<artifactId>nexus-staging-maven-plugin</artifactId>
					<version>1.6.13</version>
					<extensions>true</extensions>
					<configuration>
						<serverId>ossrh</serverId>
						<nexusUrl>https://${nexus.host}/</nexusUrl>
						<autoReleaseAfterClose>true</autoReleaseAfterClose>
					</configuration>
				</plugin>

				<plugin>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-maven-plugin</artifactId>
					<version>2.7.3</version>
				</plugin>

				<!-- Eclipse m2e settings; does not influence Maven build. -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<!-- Ignore Eclipse's lack of support for the Maven Antrun Plugin. -->
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-antrun-plugin</artifactId>
										<versionRange>[1.3,)</versionRange>
										<goals>
											<goal>run</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<!-- set up properties -->
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>set-project-release-version</id>
						<goals>
							<goal>regex-property</goal>
						</goals>
						<configuration>
							<name>project.releaseVersion</name>
							<value>${project.version}</value>
							<regex>-.*</regex>
							<failIfNoMatch>false</failIfNoMatch>
						</configuration>
					</execution>
					<execution>
						<id>set-build-year</id>
						<goals>
							<goal>timestamp-property</goal>
						</goals>
						<configuration>
							<locale>en</locale>
							<timeSource>build</timeSource>
							<timeZone>UTC</timeZone>
							<name>build.year</name>
							<pattern>yyyy</pattern>
						</configuration>
					</execution>
					<execution>
						<id>set-build-date</id>
						<goals>
							<goal>timestamp-property</goal>
						</goals>
						<configuration>
							<locale>en</locale>
							<timeSource>build</timeSource>
							<timeZone>UTC</timeZone>
							<name>build.date</name>
							<pattern>yyyy-MM-dd</pattern>
						</configuration>
					</execution>
					<execution>
						<id>set-build-timestamp</id>
						<goals>
							<goal>timestamp-property</goal>
						</goals>
						<configuration>
							<locale>en</locale>
							<timeSource>build</timeSource>
							<timeZone>UTC</timeZone>
							<name>build.timestamp</name>
							<pattern>yyyy-MM-dd'T'HH:mm'Z'</pattern>
						</configuration>
					</execution>
					<!-- Sets Boolean `${_isSkipGenerateExe}` equivalent to "not defined `${exe.main.class}`". -->
					<execution>
						<id>set-is-skip-generate-exe-true-or-prefixed</id>
						<phase>validate</phase>
						<goals>
							<goal>regex-property</goal>
						</goals>
						<configuration>
							<name>_isSkipGenerateExe</name>
							<value>_${exe.main.class}</value>
							<regex>_\$\{exe.main.class\}</regex>
							<replacement>true</replacement>
							<failIfNoMatch>false</failIfNoMatch>
						</configuration>
					</execution>
					<execution>
						<id>set-is-skip-generate-exe</id>
						<phase>initialize</phase>
						<goals>
							<goal>regex-property</goal>
						</goals>
						<configuration>
							<name>_isSkipGenerateExe</name>
							<value>${_isSkipGenerateExe}</value>
							<regex>_.*</regex>
							<replacement>false</replacement>
							<failIfNoMatch>false</failIfNoMatch>
						</configuration>
					</execution>
					<!--
						Sets `${_exe.main.classAsAbsolutePath}` to absolute path version of `exe.main.class`,
						e.g. `/com/example/MainClass` for `com.example.MainClass`.
						If `${exe.main.class}` is undefined, the value will be invalid and should be ignored. 
					-->
					<execution>
						<id>set-exe-main-class-as-path</id>
						<goals>
							<goal>regex-property</goal>
						</goals>
						<configuration>
							<name>_exe.main.classAsAbsolutePath</name>
							<value>/${exe.main.class}</value>
							<regex>\.</regex>
							<replacement>/</replacement>
							<failIfNoMatch>false</failIfNoMatch>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
			</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.5.0</version>
								</requireMavenVersion>
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
							<goal>verify</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>versions-maven-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.sonatype.plugins</groupId>
				<artifactId>nexus-staging-maven-plugin</artifactId>
			</plugin>

			<!-- Generate program executable and related distributables if `${exe.main.class}` is set. -->
			<!-- phase: package -->
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<!--
							Generates a repackaged nested executable JAR in `${buildDirectory}`.
							This execution is only enabled if `${exe.main.class}` is defined.
						-->
						<id>generate-exe-jar</id>
						<phase>package</phase>
						<goals>
							<goal>repackage</goal>
						</goals>
						<configuration>
							<skip>${_isSkipGenerateExe}</skip>
							<layout>JAR</layout>
							<classifier>exe</classifier>
							<mainClass>${exe.main.class}</mainClass>
							<executable>true</executable>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>com.akathist.maven.plugins.launch4j</groupId>
				<artifactId>launch4j-maven-plugin</artifactId>
				<executions>
					<execution>
						<!--
							Generates a Windows `.exe` file from the `-exe.jar` in `${buildDirectory}`.
							This execution is only enabled if `${exe.main.class}` is defined.
							Depends on the output of the `spring-boot-maven-plugin` `generate-exe-jar` execution.  
						 -->
						<id>generate-exe</id>
						<phase>package</phase>
						<goals>
							<goal>launch4j</goal>
						</goals>
						<configuration>
							<skip>${_isSkipGenerateExe}</skip>
							<headerType>console</headerType>
							<outfile>${binOutputDirectory}/${exe.filename}</outfile>
							<jar>${project.build.directory}/${project.artifactId}-${project.version}-exe.jar</jar>
							<errTitle>${project.name}</errTitle>
							<downloadUrl>https://adoptium.net/</downloadUrl>
							<jre>
								<path>%JAVA_HOME%;%PATH%</path>
								<minVersion>${maven.compiler.release}</minVersion>
							</jre>
							<versionInfo>
								<fileVersion>${project.releaseVersion}.0</fileVersion>
								<txtFileVersion>${project.version}</txtFileVersion>
								<fileDescription>${project.description}</fileDescription>
								<copyright>Copyright © ${project.inceptionYear}-${build.year} ${project.organization.name}. All rights reserved.</copyright>
								<productName>${project.name}</productName>
								<internalName>${project.artifactId}</internalName>
								<productVersion>${project.releaseVersion}.0</productVersion>
								<txtProductVersion>${project.version}</txtProductVersion>
								<originalFilename>${exe.filename}</originalFilename>
							</versionInfo>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<!-- phase: generate-resources -->
					<execution>
						<!--
							Generates a build properties file for `${exe.main.class}`, e.g. for `com.example.MainClass`
							in the form `target/classes/com/example/MainClass-build.properties.xml`.
						-->
						<id>generate-bin-assembly-descriptor</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<skip>${_isSkipGenerateExe}</skip>
							<target>
								<echo file="${project.build.outputDirectory}${_exe.main.classAsAbsolutePath}-build.properties.xml" encoding="UTF-8">
									<![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
	<comment>Generated build information.</comment>
	<entry key="name">${_xml.cdata.begin}${project.name}${_xml.cdata.end}</entry>
	<entry key="version">${_xml.cdata.begin}${project.version}${_xml.cdata.end}</entry>
	<entry key="builtAt">${_xml.cdata.begin}${build.timestamp}${_xml.cdata.end}</entry>
</properties>]]>
								</echo>
							</target>
						</configuration>
					</execution>
					<!-- phase: package -->
					<execution>
						<!--
							Copies the executable JAR to `${binOutputDirectory}` as a *nix script and makes it executable.
							This execution is only enabled if `${exe.main.class}` is defined.
							Depends on the output of the `spring-boot-maven-plugin` `generate-exe-jar` execution.
						 -->
						<id>copy-exe-jar-as-script</id>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<skip>${_isSkipGenerateExe}</skip>
							<target>
								<copy file="${project.build.directory}/${project.artifactId}-${project.version}-exe.jar" tofile="${binOutputDirectory}/${exe.base.filename}" />
								<chmod file="${binOutputDirectory}/${exe.base.filename}" perm="+x" />
							</target>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<distributionManagement>
		<snapshotRepository>
			<id>ossrh</id>
			<url>https://${nexus.host}/content/repositories/snapshots</url>
		</snapshotRepository>
		<repository>
			<id>ossrh</id>
			<url>https://${nexus.host}/service/local/staging/deploy/maven2/</url>
		</repository>
	</distributionManagement>

	<profiles>
		<profile>
			<!-- Provides additional atifacts and signs all artifacts for publishing. -->
			<id>publish</id>
			<build>
				<plugins>
					<!-- phase: prepare-package -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<!--
									Generates an assembly descriptor for the binary distribution.
								-->
								<id>generate-bin-assembly-descriptor</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<skip>${_isSkipGenerateExe}</skip>
									<target>
										<echo file="${assemblyDirectory}/bin.xml" encoding="UTF-8">
											<![CDATA[<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
	<id>bin</id>
	<formats>
		<format>tar.xz</format>
		<format>zip</format>
	</formats>
	<fileSets>
		<fileSet>
			<directory>${project.build.directory}</directory>
			<includes>
				<include>*-exe.jar</include>
			</includes>
			<outputDirectory>bin</outputDirectory>
		</fileSet>
		<fileSet>
			<directory>${binOutputDirectory}</directory>
			<outputDirectory>bin</outputDirectory>
			<!--
				Set access permissions to `-rwxrwxr-x`, which corresponds to adding `+x` to a created file.
				Manually setting permissions files in the archive is necessary for building on Windows,
				because input files will have lost attributes during the build process.
			-->
			<fileMode>0775</fileMode>
		</fileSet>
	</fileSets>
</assembly>]]>
										</echo>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<!-- phase: package -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-assembly-plugin</artifactId>
						<executions>
							<execution>
								<!--
									Assembles the binary distribution.
									Depends on the output of the `generate-bin-assembly-descriptor` execution.
									Implementation Note: It is unclear if it is guaranteed that profile plugins
									are executed after main build plugins at the same level. If there are problems
									in the future because of Antrun tasks in the main build in the `package` phase,
									this task can be moved to the `post-integration-test` phase.
									See [MNG-4975](https://issues.apache.org/jira/browse/MNG-4975).
									See [MNG-5987](https://issues.apache.org/jira/browse/MNG-5987). 
								-->
								<id>assemble-bin-dist</id>
								<phase>package</phase>
								<goals>
									<goal>single</goal>
								</goals>
								<configuration>
									<skipAssembly>${_isSkipGenerateExe}</skipAssembly>
									<descriptors>
										<descriptor>${assemblyDirectory}/bin.xml</descriptor>
									</descriptors>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<!-- phase: verify -->
					<plugin>
						<!-- Requires [GnuPG](https://www.gnupg.org/download/) to be installed. -->
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<executions>
							<execution>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<!-- Performs a "quick" build without running tests and checks. -->
			<id>quick</id>
			<properties>
				<maven.javadoc.skip>true</maven.javadoc.skip> <!-- Javadoc -->
				<skipTests>true</skipTests> <!-- Surefire -->
				<skipITs>true</skipITs> <!-- Failsafe -->
			</properties>
		</profile>

		<profile>
			<!-- Copies binary files to `target/bin` if there is a `src/bin` directory. -->
			<id>prepare-bin-files</id>

			<activation>
				<file>
					<exists>${binSourceDirectory}</exists>
				</file>
			</activation>

			<build>
				<plugins>
					<!-- phase: generate-resources -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<!--
									Copies scripts from `${binSourceDirectory}` to `${binOutputDirectory}`.
									This is only necessary if special binary files from the source tree should be included.,
									such as `.bat` or `.sh` scripts.
									Startup shell scripts have largely been replaced by a using the executable JAR as a *unix script
									(see `copy-exe-jar-as-script`) and by generating an executable for Windows (see `generate-exe`).  
									Uses `~{}` delimiters, because `${}` clashes with script variable replacement.
								 -->
								<id>copy-bin</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>resources</goal>
								</goals>
								<configuration>
									<resources>
										<resource>
											<directory>${binSourceDirectory}</directory>
											<includes>
												<include>**/*.bat</include>
												<include>**/*.sh</include>
											</includes>
											<filtering>true</filtering>
										</resource>
									</resources>
									<useDefaultDelimiters>false</useDefaultDelimiters>
									<delimiters>
										<delimiter>~{*}</delimiter>
									</delimiters>
									<outputDirectory>${binOutputDirectory}</outputDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<!--
									Create the `${binOutputDirectory}` directory for use by later tasks.
								 -->
								<id>create-bin-output-dir</id>
								<phase>initialize</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<mkdir dir="${binOutputDirectory}" />
									</target>
								</configuration>
							</execution>
							<execution>
								<!--
									Enable execute permission for the shell scripts in `${binOutputDirectory}`.
									Remove the `.sh` extension from shell scripts in `${binOutputDirectory}`.
								 -->
								<id>process-shell-scripts</id>
								<phase>process-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<chmod dir="${binOutputDirectory}" includes="**/*.sh" perm="+x" />
										<move todir="${binOutputDirectory}">
											<fileset dir="${binOutputDirectory}" includes="**/*.sh" />
											<mapper type="glob" from="*.sh" to="*" />
										</move>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
