From 6e79521fffdc67239c822389d6ccd6eef18ec878 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Fri, 25 Nov 2016 11:17:58 +0100 Subject: [PATCH] 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 --- .../boot/maven/AbstractRunMojo.java | 2 +- .../springframework/boot/maven/StopMojo.java | 2 +- .../src/site/apt/examples/it-skip.apt.vm | 63 +++++++++++++++++++ .../src/site/apt/index.apt | 2 + .../src/site/site.xml | 1 + 5 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java index dc08eff497..facacfd496 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractRunMojo.java @@ -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 diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java index b6737801ab..87309eb856 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java +++ b/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StopMojo.java @@ -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 diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm new file mode 100644 index 0000000000..f846bca20c --- /dev/null +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/examples/it-skip.apt.vm @@ -0,0 +1,63 @@ + ----- + Skip integration tests + ----- + Stephane Nicoll + ----- + 2016-11-25 + ----- + + The <<>> 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 <> goal runs: + +--- + + + false + ... + + ... + + ... + + ... + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + pre-integration-test + + start + + + ${skip.it} + + + + post-integration-test + + stop + + + ${skip.it} + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + ${skip.it} + + + ... + + ... + +--- + + By default, the integration tests will run but this setup allows you to easily disable + them on the command-line as follows: <<>>. diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt index dcf5084405..033d484e26 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/apt/index.apt @@ -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}} diff --git a/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml b/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml index 0975cc901d..c3ffb24f30 100644 --- a/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml +++ b/spring-boot-tools/spring-boot-maven-plugin/src/site/site.xml @@ -12,6 +12,7 @@ +