<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-contract-tools</artifactId>
		<version>4.2.0-RC1</version>
		<relativePath>..</relativePath>
	</parent>

	<artifactId>spring-cloud-contract-gradle-plugin</artifactId>
	<packaging>pom</packaging>

	<name>Spring Cloud Contract Gradle Plugin</name>
	<description>Spring Cloud Contract Gradle Plugin</description>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<gradle.task>build</gradle.task>
		<build-helper-maven-plugin.phase>package</build-helper-maven-plugin.phase>
		<gradle.publish-plugins.task>publishPlugins</gradle.publish-plugins.task>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-verifier</artifactId>
			<exclusions>
				<exclusion>
					<groupId>*</groupId>
					<artifactId>*</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-converters</artifactId>
			<exclusions>
				<exclusion>
					<groupId>*</groupId>
					<artifactId>*</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-stub-runner</artifactId>
			<exclusions>
				<exclusion>
					<groupId>*</groupId>
					<artifactId>*</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-shade</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.resolver</groupId>
			<artifactId>maven-resolver-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jgit</groupId>
			<artifactId>org.eclipse.jgit</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.jgit</groupId>
			<artifactId>org.eclipse.jgit.ssh.jsch</artifactId>
		</dependency>
		<dependency>
			<groupId>com.jcraft</groupId>
			<artifactId>jsch.agentproxy.jsch</artifactId>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.core</groupId>
			<artifactId>jackson-databind</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
		</dependency>
	</dependencies>

	<build>
		<!-- We're building the project via Gradle and if we don't put in a fake source directory then Maven will try to actually compile the Gradle code -->
		<sourceDirectory>src/main/fake</sourceDirectory>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<failIfNoTests>false</failIfNoTests>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<version>3.3.2</version>
				<configuration>
					<filesets>
						<fileset>
							<directory>build</directory>
						</fileset>
						<fileset>
							<directory>target</directory>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>${build-helper-maven-plugin.version}</version>
				<executions>
					<execution>
						<id>attach-zip</id>
						<phase>none</phase>
					</execution>
					<execution>
						<id>attach-artifacts</id>
						<phase>${build-helper-maven-plugin.phase}</phase>
						<goals>
							<goal>attach-artifact</goal>
						</goals>
						<configuration>
							<artifacts>
								<artifact>
									<file>build/libs/${project.artifactId}-${project.version}.jar</file>
									<type>jar</type>
								</artifact>
								<artifact>
									<file>build/libs/${project.artifactId}-${project.version}-groovydoc.jar</file>
									<type>jar</type>
									<classifier>groovydoc</classifier>
								</artifact>
								<artifact>
									<file>build/libs/${project.artifactId}-${project.version}-javadoc.jar</file>
									<type>jar</type>
									<classifier>javadoc</classifier>
								</artifact>
								<artifact>
									<file>build/libs/${project.artifactId}-${project.version}-sources.jar</file>
									<type>jar</type>
									<classifier>sources</classifier>
								</artifact>
							</artifacts>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<profiles>
		<profile>
			<id>default</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>${gradle.task}</argument>
										<!--<argument>jacocoTestReport</argument>-->
										<argument>-PverifierVersion=${project.version}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>milestone</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>${gradle.task}</argument>
										<!--<argument>jacocoTestReport</argument>-->
										<argument>-PverifierVersion=${project.version}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>windows</id>
			<activation>
				<os>
					<name>windows</name>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>gradlew.bat</executable>
									<arguments>
										<argument>${gradle.task}</argument>
										<!--<argument>jacocoTestReport</argument>-->
										<argument>-PverifierVersion=${project.version}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>fast</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>${gradle.task}</argument>
										<!--<argument>jacocoTestReport</argument>-->
										<argument>-Pfast</argument>
										<argument>-PverifierVersion=${project.version}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>dry-run</id>
			<activation>
				<activeByDefault>true</activeByDefault>
				<property>
					<name>env.DRY_RUN</name>
					<value>true</value>
				</property>
			</activation>
			<properties>
				<gradle.publish-plugins.task>-Pexample=value</gradle.publish-plugins.task>
			</properties>
		</profile>
		<profile>
			<id>central</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>clean</argument>
										<argument>${gradle.task}</argument>
										<argument>-PverifierVersion=${project.version}</argument>
										<argument>-Pcentral</argument>
										<argument>-PsonatypeUsername=${env.SONATYPE_USER}</argument>
										<argument>-PsonatypePassword=${env.SONATYPE_PASSWORD}</argument>
										<argument>-Pgradle.publish.key=${env.GRADLE_PUBLISH_KEY}</argument>
										<argument>-Pgradle.publish.secret=${env.GRADLE_PUBLISH_SECRET}</argument>
										<argument>${gradle.publish-plugins.task}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>java13</id>
			<activation>
				<jdk>13</jdk>
			</activation>
			<properties>
				<build-helper-maven-plugin.phase>none</build-helper-maven-plugin.phase>
			</properties>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<!-- we need a different version so as not to inherit from parent -->
						<version>${exec-maven-plugin.version}</version>
						<executions>
							<execution>
								<id>gradle-update-to-6</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>wrapper</argument>
										<argument>--gradle-version</argument>
										<argument>6.0</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
							<execution>
								<id>gradle</id>
								<phase>package</phase>
								<configuration>
									<executable>./gradlew</executable>
									<arguments>
										<argument>${gradle.task}</argument>
										<!--<argument>jacocoTestReport</argument>-->
										<argument>-PverifierVersion=${project.version}</argument>
									</arguments>
								</configuration>
								<goals>
									<goal>exec</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
