Add failsafe default configuration

Provides better default for integration tests. Also expand the
documentation of the maven plugin in that area.

Closes gh-4223
This commit is contained in:
Stephane Nicoll 2016-01-26 09:59:37 +01:00
parent e293008c3f
commit 11d8515594
3 changed files with 61 additions and 1 deletions

View File

@ -2046,7 +2046,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18</version>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -61,6 +61,18 @@
<pluginManagement>
<plugins>
<!-- Apply more sensible defaults for user projects -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>

View File

@ -231,6 +231,54 @@ spring.devtools.remote.restart.enabled=false
Such setup can now use the {{{http://maven.apache.org/surefire/maven-failsafe-plugin/}failsafe-plugin}} to
run your integration tests as you would expect.
You could also configure a more advanced setup to skip the integration tests when a specific property has
been set:
---
<properties>
<it.skip>false</it.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${it.skip}</skip>
</configuration>
</plugin>
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${it.skip}</skip>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${it.skip}</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
---
If you run <<<mvn verify -Dit.skip=true>>> your integration tests will be skipped altogether.
For more detailed examples of how to configure this goal see:
* {{{./examples/it-random-port.html}Random port for integration tests}}