<?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>me.chrissw-r1</groupId>
		<artifactId>general-parent</artifactId>
		<version>3.0.31</version>
	</parent>

	<!-- project identifier -->
	<artifactId>build-parent</artifactId>
	<packaging>pom</packaging>

	<!-- project metadata -->
	<name>Build Parent</name>
	<description>
		This project defines build steps for all artifact-producing projects.
	</description>

	<properties>
		<!-- technically-based properties -->
		<project.parent.relativedir>../</project.parent.relativedir>
		<general-resources.skipUnpack>false</general-resources.skipUnpack>

		<!-- plugin versions -->
		<plugin.assembly.version>3.8.0</plugin.assembly.version>
	</properties>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>${project.build.directory}/generated-resources</directory>
				<includes>
					<include>project.properties</include>
				</includes>
				<filtering>true</filtering>
			</resource>
		</resources>
		<pluginManagement>
			<plugins>
				<plugin>
					<artifactId>maven-dependency-plugin</artifactId>
					<dependencies>
						<dependency>
							<groupId>me.chrissw-r1</groupId>
							<artifactId>general-resources</artifactId>
							<version>3.0.31</version>
						</dependency>
					</dependencies>
				</plugin>
				<plugin>
					<artifactId>maven-assembly-plugin</artifactId>
					<version>${plugin.assembly.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<!--plugin>
				<groupId>nl.praegus</groupId>
				<artifactId>jetspeed-unpack-maven-plugin</artifactId>
			</plugin-->
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>unpack-common-resources</id>
			<activation>
				<property>
					<name>fullBuild</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
								<id>unpack-common-project-files</id>
								<phase>initialize</phase>
								<goals>
									<goal>unpack</goal>
								</goals>
								<configuration>
									<skip>${general-resources.skipUnpack}</skip>
									<artifactItems>
										<artifactItem>
											<groupId>me.chrissw-r1</groupId>
											<artifactId>general-resources</artifactId>
											<version>${general-parent.version}</version>
											<type>jar</type>
											<overWrite>true</overWrite>
											<outputDirectory>${project.module-root.basedir}</outputDirectory>
											<includes>resources/default.gitignore,resources/.editorconfig</includes>
											<fileMappers>
												<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FlattenFileMapper" />
											</fileMappers>
										</artifactItem>
									</artifactItems>
								</configuration>
							</execution>
							<execution>
								<id>unpack-common-resources</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>unpack</goal>
								</goals>
								<configuration>
									<skip>${general-resources.skipUnpack}</skip>
									<artifactItems>
										<artifactItem>
											<groupId>me.chrissw-r1</groupId>
											<artifactId>general-resources</artifactId>
											<version>${general-parent.version}</version>
											<type>jar</type>
											<outputDirectory>${project.build.directory}/generated-resources</outputDirectory>
											<includes>unfiltered-resources/project.properties,unfiltered-resources/lrgrwrks.txt</includes>
											<fileMappers>
												<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FlattenFileMapper" />
											</fileMappers>
										</artifactItem>
									</artifactItems>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-lrgrwrks</id>
								<phase>process-resources</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.outputDirectory}</outputDirectory>
									<resources>
										<resource>
											<directory>${project.build.directory}/generated-resources</directory>
											<includes>
												<include>lrgrwrks.txt</include>
											</includes>
											<filtering>true</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>move-gitignore</id>
								<phase>process-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<move file="${project.module-root.basedir}/default.gitignore" tofile="${project.module-root.basedir}/.gitignore" />
									</target>
								</configuration>
							</execution>
							<execution>
								<id>delete-gitignore</id>
								<phase>package</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<delete file="${project.module-root.basedir}/default.gitignore" />
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>pack-dist</id>
			<activation>
				<property>
					<name>distribution</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>set-dist-artifact-extension</id>
								<phase>validate</phase>
								<goals>
									<goal>regex-property</goal>
								</goals>
								<configuration>
									<name>project.build.artifact.extension</name>
									<value>${project.packaging}</value>
									<regex>^(?!pom$).+$</regex>
									<replacement>zip</replacement>
									<failIfNoMatch>false</failIfNoMatch>
								</configuration>
							</execution>
							<execution>
								<id>set-dist-artifact-filename</id>
								<phase>validate</phase>
								<goals>
									<goal>regex-property</goal>
								</goals>
								<configuration>
									<name>project.build.artifact.fileName</name>
									<value>${project.build.artifact.fileName}</value>
									<regex>\.(?!pom$)[^.]+$</regex>
									<replacement>-dist.zip</replacement>
									<failIfNoMatch>false</failIfNoMatch>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
								<id>unpack-assembly-definitions</id>
								<phase>initialize</phase>
								<goals>
									<goal>unpack</goal>
								</goals>
								<configuration>
									<artifactItems>
										<artifactItem>
											<groupId>me.chrissw-r1</groupId>
											<artifactId>general-resources</artifactId>
											<version>${general-parent.version}</version>
											<type>jar</type>
											<overWrite>true</overWrite>
											<outputDirectory>${project.basedir}/src/assembly</outputDirectory>
											<includes>unfiltered-resources/pack-dist.xml</includes>
											<fileMappers>
												<fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FlattenFileMapper" />
											</fileMappers>
										</artifactItem>
									</artifactItems>
								</configuration>
							</execution>
							<execution>
								<id>copy-dependencies</id>
								<phase>package</phase>
								<goals>
									<goal>copy-dependencies</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
									<includeScope>runtime</includeScope>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-assembly-plugin</artifactId>
						<executions>
							<execution>
								<id>pack-dist</id>
								<phase>package</phase>
								<goals>
									<goal>single</goal>
								</goals>
								<configuration>
									<descriptors>
										<descriptor>src/assembly/pack-dist.xml</descriptor>
									</descriptors>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<modules>
		<module>java-parent</module>
		<module>js-parent</module>
		<module>php-parent</module>
		<module>python-parent</module>
	</modules>
	<url>https://docs.urelion.world/me.chrissw-r1/general-parent/3.0.31</url>
	<licenses>
		<license>
			<name>Apache License (ASL), Version 2.0 (Apache-2.0)</name>
			<url>https://raw.githubusercontent.com/spdx/license-list-data/main/text/Apache-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>
	<developers>
		<developer>
			<id>ChrissW-R1</id>
			<name>ChrissW-R1</name>
			<email>contact@ChrissW-R1.me</email>
			<url>https://ChrissW-R1.me</url>
			<timezone>Europe/Berlin</timezone>
		</developer>
	</developers>
</project>
