<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>de.rcenvironment</groupId>
	<version>1.0.0</version>
	<artifactId>de.rcenvironment.maven.preprocessor</artifactId>
	<name>RCE Module ${project.artifactId}</name>
	<packaging>pom</packaging>

	<properties>
		<!-- default main class to use for chaining Maven invocations -->
		<rce.maven.chaining.mainClass>org.codehaus.plexus.classworlds.launcher.Launcher</rce.maven.chaining.mainClass>
		<maven.versions.groovy>3.0.10</maven.versions.groovy>
		<maven.versions.gmavenplus>1.13.1</maven.versions.gmavenplus>
	</properties>

	<build>
		<defaultGoal>compile</defaultGoal>
		<plugins>
			<plugin>
				<groupId>org.codehaus.gmavenplus</groupId>
				<artifactId>gmavenplus-plugin</artifactId>
				<version>${maven.versions.gmavenplus}</version>
				<executions>
					<execution>
						<id>run-groovy</id>
						<phase>initialize</phase>
						<goals>
							<goal>addSources</goal>
							<goal>compile</goal>
							<goal>execute</goal>
						</goals>
						<configuration>
							<scripts>
								<script>
									<![CDATA[
										def envAdapter = new BuildEnvironmentAdapter(project)
										new RCEBuildPreprocessor(envAdapter).run()
									]]>
								</script>
							</scripts>
						</configuration>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.codehaus.groovy</groupId>
						<artifactId>groovy</artifactId>
						<version>${maven.versions.groovy}</version>
						<type>pom</type>
					</dependency>
				</dependencies>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>3.1.0</version>
				<executions>
					<execution>
						<id>enforce-property</id>
						<phase>initialize</phase>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<requireProperty>
									<property>rce.maven.chaining.mainClass</property>
								</requireProperty>
								<requireProperty>
									<property>rce.maven.internal.secondStageArguments</property>
								</requireProperty>
							</rules>
							<fail>true</fail>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.3.2</version>
				<executions>
					<execution>
						<goals>
							<goal>java</goal>
						</goals>
						<phase>compile</phase>
						<configuration>
							<mainClass>${rce.maven.chaining.mainClass}</mainClass>
							<commandlineArgs>${rce.maven.internal.secondStageArguments}</commandlineArgs>
							<includeProjectDependencies>false</includeProjectDependencies>
							<killAfter>-1</killAfter> <!-- suppress deprecation warning -->
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<!-- needed on project level for compilation; see https://github.com/groovy/GMavenPlus/issues/57 -->
		<dependency>
			<groupId>org.codehaus.groovy</groupId>
			<artifactId>groovy-all</artifactId>
			<version>${maven.versions.groovy}</version>
			<type>pom</type>
		</dependency>
	</dependencies>

</project>