Expose skip property consistently

This commit makes sure that the `skip` command-line property can be used
for all goals of the maven plugin.

A dedicated sample for integration tests has also been added as this
change may confuse users, especially those who wish to skip a certain
goal and not the plugin execution altogether.

Closes gh-7313
This commit is contained in:
Stephane Nicoll 2016-11-25 11:17:58 +01:00
parent 0befc310cd
commit 6e79521fff
5 changed files with 68 additions and 2 deletions

View File

@ -167,7 +167,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
* Skip the execution.
* @since 1.3.2
*/
@Parameter(defaultValue = "false")
@Parameter(property = "skip", defaultValue = "false")
private boolean skip;
@Override

View File

@ -75,7 +75,7 @@ public class StopMojo extends AbstractMojo {
* Skip the execution.
* @since 1.3.2
*/
@Parameter(defaultValue = "false")
@Parameter(property = "skip", defaultValue = "false")
private boolean skip;
@Override

View File

@ -0,0 +1,63 @@
-----
Skip integration tests
-----
Stephane Nicoll
-----
2016-11-25
-----
The <<<skip>>> property allows to skip the execution of the Spring Boot maven plugin
altogether. This example shows how you can skip integration tests with a command-line
property and still make sure that the <<repackage>> goal runs:
---
<project>
<properties>
<skip.it>false</skip.it>
...
</properties>
...
<build>
...
<plugins>
...
<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>${skip.it}</skip>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</plugin>
...
</plugins>
...
</build>
---
By default, the integration tests will run but this setup allows you to easily disable
them on the command-line as follows: <<<mvn verify -Dskip.it=true>>>.

View File

@ -54,6 +54,8 @@ Spring Boot Maven Plugin
* {{{./examples/it-random-port.html}Random port for integration tests}}
* {{{./examples/it-skip.html}Skip integration tests}}
* {{{./examples/run-profiles.html}Specify active profiles}}
* {{{./examples/build-info.html}Generate build information}}

View File

@ -12,6 +12,7 @@
<item name="Exclude a dependency" href="examples/exclude-dependency.html"/>
<item name="Debug the application" href="examples/run-debug.html"/>
<item name="Random port for integration tests" href="examples/it-random-port.html"/>
<item name="Skip integration tests" href="examples/it-skip.html"/>
<item name="Specify active profiles" href="examples/run-profiles.html"/>
<item name="Generate build information" href="examples/build-info.html"/>
</menu>