diff --git a/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ExecuteMojo.java b/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ExecuteMojo.java index afebf749..e4c30ea8 100644 --- a/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ExecuteMojo.java +++ b/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/ExecuteMojo.java @@ -82,6 +82,15 @@ public class ExecuteMojo @Parameter private Map defaults; + + /** + * Skip the execution of this mojo. + * + * @since 2.2.0 + */ + @Parameter(property = "gmaven.execute.skip", defaultValue = "false") + private boolean skip; + @Override protected void run() throws Exception { final ClassSource classSource = classSourceFactory.create(source); @@ -101,4 +110,10 @@ protected void customizeProperties(final PropertiesBuilder builder) { builder.setProperties(properties) .setDefaults(defaults); } + + @Override + protected boolean isSkipped() { + return skip; + } + } diff --git a/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java b/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java index 291133e5..ee7ce59e 100644 --- a/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java +++ b/groovy-maven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java @@ -38,6 +38,10 @@ protected MojoSupport() { } public void execute() throws MojoExecutionException, MojoFailureException { + if (isSkipped()) { + getLog().info("Skipping as requested by the user"); + return; + } try { try { log.trace("Prepare"); @@ -67,4 +71,8 @@ protected void prepare() throws Exception { protected void cleanup() throws Exception { // empty } + + protected boolean isSkipped() { + return false; + } }