<?xml version="1.0" encoding="UTF-8"?>
<project>
	<modelVersion>4.0.0</modelVersion>
	<artifactId>integration-tests</artifactId>
	<!-- tag::random-port[] -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>reserve-tomcat-port</id>
						<goals>
							<goal>reserve-network-port</goal>
						</goals>
						<phase>process-resources</phase>
						<configuration>
							<portNames>
								<portName>tomcat.http.port</portName>
							</portNames>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>pre-integration-test</id>
						<goals>
							<goal>start</goal>
						</goals>
						<configuration>
							<arguments>
								<argument>--server.port=${tomcat.http.port}</argument>
							</arguments>
						</configuration>
					</execution>
					<execution>
						<id>post-integration-test</id>
						<goals>
							<goal>stop</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<configuration>
					<systemPropertyVariables>
						<test.server.port>${tomcat.http.port}</test.server.port>
					</systemPropertyVariables>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<!-- end::random-port[] -->
</project>

