<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2013-2020 the original author or authors.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      https://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->

<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-build</artifactId>
		<version>4.1.6-SNAPSHOT</version>
		<relativePath/>
	</parent>

	<artifactId>spring-cloud-kubernetes</artifactId>
	<version>3.1.6-SNAPSHOT</version>
	<packaging>pom</packaging>
	<name>Spring Cloud Kubernetes</name>

	<url>https://cloud.spring.io</url>
	<inceptionYear>2017</inceptionYear>

	<organization>
		<name>Pivotal Software, Inc.</name>
		<url>https://www.spring.io</url>
	</organization>

	<licenses>
		<license>
			<name>Apache License, Version 2.0</name>
			<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<url>https://github.com/spring-cloud/spring-cloud-kubernetes</url>
		<connection>
			scm:git:git://github.com/spring-cloud/spring-cloud-kubernetes.git
		</connection>
		<developerConnection>
			scm:git:ssh://git@github.com/spring-cloud/spring-cloud-kubernetes.git
		</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<properties>
		<!-- in our github actions run, we save surefire/failsafe reports in a path that looks like this: -->
		<!-- surefire-report/1/... , where "1" (and other numbers like this) are the index of the github matrix -->
		<!-- where this is running. When outside the github actions, for example locally/jenkins, we will simply store -->
		<!-- the reports in a directory: "surefire-reports/..." -->
		<surefire-reports-directory>surefire-reports</surefire-reports-directory>
		<failsafe-reports-directory>failsafe-reports</failsafe-reports-directory>
		<!-- Dependency Versions -->
		<spring-cloud-commons.version>4.1.6-SNAPSHOT</spring-cloud-commons.version>
		<spring-cloud-config.version>4.1.7-SNAPSHOT</spring-cloud-config.version>
		<spring-cloud-bus.version>4.1.4-SNAPSHOT</spring-cloud-bus.version>
		<spring-cloud-contract.version>4.1.6-SNAPSHOT</spring-cloud-contract.version>

		<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
		<maven-checkstyle-plugin.failsOnViolation>true
		</maven-checkstyle-plugin.failsOnViolation>
		<maven-checkstyle-plugin.includeTestSourceDirectory>true
		</maven-checkstyle-plugin.includeTestSourceDirectory>
	</properties>

	<modules>
		<module>spring-cloud-kubernetes-dependencies</module>
		<module>spring-cloud-kubernetes-commons</module>
		<module>spring-cloud-kubernetes-test-support</module>
		<module>spring-cloud-kubernetes-client-autoconfig</module>
		<module>spring-cloud-kubernetes-client-config</module>
		<module>spring-cloud-kubernetes-client-loadbalancer</module>
		<module>spring-cloud-kubernetes-fabric8-autoconfig</module>
		<module>spring-cloud-kubernetes-fabric8-config</module>
		<module>spring-cloud-kubernetes-fabric8-discovery</module>
		<module>spring-cloud-kubernetes-client-discovery</module>
		<module>spring-cloud-starter-kubernetes-fabric8</module>
		<module>spring-cloud-starter-kubernetes-fabric8-config</module>
		<module>spring-cloud-starter-kubernetes-fabric8-all</module>
		<module>spring-cloud-starter-kubernetes-client</module>
		<module>spring-cloud-starter-kubernetes-client-config</module>
		<module>spring-cloud-starter-kubernetes-client-loadbalancer</module>
		<module>spring-cloud-starter-kubernetes-client-all</module>
		<module>spring-cloud-kubernetes-examples</module>
		<module>spring-cloud-kubernetes-fabric8-leader</module>
		<module>spring-cloud-kubernetes-fabric8-istio</module>
		<module>spring-cloud-kubernetes-controllers</module>
		<module>spring-cloud-kubernetes-integration-tests</module>
		<module>docs</module>
		<module>spring-cloud-kubernetes-fabric8-loadbalancer</module>
		<module>spring-cloud-starter-kubernetes-fabric8-loadbalancer</module>
		<module>spring-cloud-kubernetes-discovery</module>
		<module>spring-cloud-starter-kubernetes-discoveryclient</module>
	</modules>

	<dependencyManagement>
		<dependencies>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-kubernetes-dependencies</artifactId>
				<version>${project.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-commons-dependencies</artifactId>
				<version>${spring-cloud-commons.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-config-dependencies</artifactId>
				<version>${spring-cloud-config.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-bus-dependencies</artifactId>
				<version>${spring-cloud-bus.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-contract-dependencies</artifactId>
				<version>${spring-cloud-contract.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>

			<dependency>
				<groupId>org.codehaus.groovy</groupId>
				<artifactId>groovy-all</artifactId>
				<version>${groovy.version}</version>
			</dependency>

			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-test-support</artifactId>
				<version>${spring-cloud-commons.version}</version>
				<scope>test</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>flatten-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<source>17</source>
					<target>17</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<inherited>true</inherited>
				<configuration>
					<parallel>all</parallel>
					<reuseForks>false</reuseForks>
					<includes>
						<include>${testsToRun}</include>
					</includes>
					<reportsDirectory>${project.build.directory}/${surefire-reports-directory}</reportsDirectory>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration>
					<reportsDirectory>${project.build.directory}/${failsafe-reports-directory}</reportsDirectory>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>io.spring.javaformat</groupId>
				<artifactId>spring-javaformat-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
			</plugin>
		</plugins>
	</reporting>

	<profiles>
		<profile>
			<id>spring</id>
			<repositories>
				<repository>
					<id>spring-snapshots</id>
					<name>Spring Snapshots</name>
					<url>https://repo.spring.io/snapshot</url>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
					<releases>
						<enabled>false</enabled>
					</releases>
				</repository>
				<repository>
					<id>spring-milestones</id>
					<name>Spring Milestones</name>
					<url>https://repo.spring.io/milestone</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
				<repository>
					<id>spring-releases</id>
					<name>Spring Releases</name>
					<url>https://repo.spring.io/release</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>spring-snapshots</id>
					<name>Spring Snapshots</name>
					<url>https://repo.spring.io/snapshot</url>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
					<releases>
						<enabled>false</enabled>
					</releases>
				</pluginRepository>
				<pluginRepository>
					<id>spring-milestones</id>
					<name>Spring Milestones</name>
					<url>https://repo.spring.io/milestone</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
				<pluginRepository>
					<id>spring-releases</id>
					<name>Spring Releases</name>
					<url>https://repo.spring.io/release</url>
					<snapshots>
						<enabled>false</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
		<profile>
			<id>release</id>
			<build>
				<plugins>
					<!-- TODO: move t s-c-build -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-enforcer-plugin</artifactId>
						<version>1.3.1</version>
						<executions>
							<execution>
								<id>enforce-no-snapshots</id>
								<goals>
									<goal>enforce</goal>
								</goals>
								<configuration>
									<rules>
										<requireReleaseDeps>
											<message>No Snapshots Allowed!</message>
										</requireReleaseDeps>
									</rules>
									<fail>false</fail>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>sonar</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>pre-unit-test</id>
								<goals>
									<goal>prepare-agent</goal>
								</goals>
								<configuration>
									<propertyName>surefireArgLine</propertyName>
									<destFile>${project.build.directory}/jacoco.exec
									</destFile>
								</configuration>
							</execution>
							<execution>
								<id>post-unit-test</id>
								<phase>test</phase>
								<goals>
									<goal>report</goal>
								</goals>
								<configuration>
									<!-- Sets the path to the file which contains the execution data. -->
									<dataFile>${project.build.directory}/jacoco.exec
									</dataFile>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<configuration>
							<parallel>all</parallel>
							<reuseForks>false</reuseForks>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<!-- Workaround until Paketo build packs support arm64 a.k.a. aarch64
		     See https://github.com/buildpacks/pack/issues?q=is%3Aissue+is%3Aopen+arm64 -->
		<profile>
			<id>build-image-aarch64</id>
			<activation>
				<os>
					<arch>aarch64</arch>
				</os>
			</activation>
			<properties>
				<spring-boot.build-image.builder>dashaun/builder:tiny</spring-boot.build-image.builder>
			</properties>
		</profile>
	</profiles>
</project>
