<?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">
	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-kubernetes-integration-tests</artifactId>
		<version>3.0.0-SNAPSHOT</version>
	</parent>
	<modelVersion>4.0.0</modelVersion>

	<artifactId>spring-cloud-kubernetes-fabric8-client-configmap-polling-reload</artifactId>

	<dependencies>

		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-kubernetes-fabric8-config</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-kubernetes-test-support</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-webflux</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-actuator</artifactId>
		</dependency>
		<dependency>
			<groupId>com.github.docker-java</groupId>
			<artifactId>docker-java-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.github.docker-java</groupId>
			<artifactId>docker-java-transport-httpclient5</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>../src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>

		<plugins>
			<!-- build image in the 'package' phase, and ignore plain tests -->
			<!-- via maven-surefire-plugin::skipTests -->
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<imageName>docker.io/springcloud/${project.artifactId}:${project.version}</imageName>
					<imageBuilder>paketobuildpacks/builder</imageBuilder>
				</configuration>
				<executions>
					<execution>
						<id>build-image</id>
						<configuration>
							<skip>${skip.build.image}</skip>
						</configuration>
						<phase>package</phase>
						<goals>
							<goal>build-image</goal>
						</goals>
					</execution>
					<execution>
						<id>repackage</id>
						<phase>package</phase>
						<goals>
							<goal>repackage</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- ignore plain tests (in the 'test' phase), so that we could build the image first, see above -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skipTests>true</skipTests>
				</configuration>
			</plugin>

			<!-- run tests in the 'integration-tests' phase, one that is after 'package' (where we build the image) -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>integration-test</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<includes>
						<include>${testsToRun}</include>
					</includes>
				</configuration>
			</plugin>
		</plugins>

	</build>

</project>
