<?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>2.2.1.RELEASE</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>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-converters</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-contract-stub-runner</artifactId>
		</dependency>
	</dependencies>

	<build>
		<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.0.0</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-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>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>
