diff --git a/maven-plugin-plugin/src/it/skip/invoker.properties b/maven-plugin-plugin/src/it/skip/invoker.properties
new file mode 100644
index 0000000..4c83645
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/invoker.properties
@@ -0,0 +1,2 @@
+invoker.goals = install
+invoker.mavenOpts = -Dmaven.plugin.skip=true
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/skip/pom.xml b/maven-plugin-plugin/src/it/skip/pom.xml
new file mode 100644
index 0000000..a54c994
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/pom.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.it0013
+ mplugin-174
+ 1.0
+ maven-plugin
+
+ MPLUGIN-174
+
+ Test the skip property
+
+
+
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ @project.version@
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java
new file mode 100644
index 0000000..69354f6
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java
@@ -0,0 +1,67 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Touches a test file.
+ *
+ * @goal it0013
+ */
+public class CoreIt0013Mojo
+ extends AbstractMojo
+{
+
+ /**
+ * @parameter expression="${project.build.directory}"
+ * @required
+ */
+ private String outputDirectory;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ getLog().info( "outputDirectory = " + outputDirectory );
+
+ File f = new File( outputDirectory );
+
+ if ( !f.exists() )
+ {
+ f.mkdirs();
+ }
+
+ File touch = new File( f, "touch.txt" );
+
+ try
+ {
+ touch.createNewFile();
+ }
+ catch ( IOException e )
+ {
+ throw new MojoExecutionException( "Error writing verification file.", e );
+ }
+ }
+
+}
diff --git a/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
new file mode 100644
index 0000000..18ce947
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
@@ -0,0 +1,72 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Touches a test file.
+ *
+ * @goal first
+ * @requiresDependencyResolution test
+ * @phase integration-test
+ * @execute phase="generate-sources" lifecycle="cobertura"
+ * @deprecated Don't use!
+ * @since 1.2
+ */
+public class FirstMojo
+ extends AbstractMojo
+{
+
+ /**
+ * Project directory.
+ * @parameter default-value="${basedir}"
+ * @readonly
+ */
+ private File basedir;
+
+ /**
+ * @parameter expression="${first.touchFile}" default-value="${project.build.directory}/touch.txt"
+ * @required
+ */
+ private File touchFile;
+
+ /**
+ * @parameter alias="alias"
+ * @deprecated As of 0.2
+ * @since 0.1
+ */
+ private String aliasedParam;
+
+ /**
+ * @component role="org.apache.maven.project.MavenProjectHelper" roleHint="test"
+ */
+ private Object projectHelper;
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ }
+
+}
diff --git a/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
new file mode 100644
index 0000000..ef12e16
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
@@ -0,0 +1,39 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+
+/**
+ * Does nothing special.
+ *
+ * @goal second
+ * @requiresDependencyCollection compile
+ * @threadSafe
+ */
+public class SecondMojo
+ extends AbstractMojo
+{
+
+ public void execute()
+ {
+ }
+
+}
diff --git a/maven-plugin-plugin/src/it/skip/verify.groovy b/maven-plugin-plugin/src/it/skip/verify.groovy
new file mode 100644
index 0000000..daeeca2
--- /dev/null
+++ b/maven-plugin-plugin/src/it/skip/verify.groovy
@@ -0,0 +1,4 @@
+File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" );
+assert !descriptorFile.isFile()
+
+return true;
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
index c2f2cdf..13d1704 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
@@ -106,6 +106,14 @@ public abstract class AbstractGeneratorMojo
*/
protected Set extractors;
+ /**
+ * Set this to "true" to skip invoking any goals or reports of the plugin.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.skip}"
+ * @since 2.8
+ */
+ protected boolean skip;
+
/**
* @return the output directory where files will be generated.
*/
@@ -124,6 +132,11 @@ public abstract class AbstractGeneratorMojo
{
return;
}
+ if ( skip )
+ {
+ getLog().warn( "Execution skipped" );
+ return;
+ }
if ( project.getArtifactId().toLowerCase().startsWith( "maven-" )
&& project.getArtifactId().toLowerCase().endsWith( "-plugin" )
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
index f7ca26e..1bac881 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/HelpGeneratorMojo.java
@@ -79,7 +79,7 @@ public class HelpGeneratorMojo
{
super.execute();
- if ( !project.getCompileSourceRoots().contains( outputDirectory.getAbsolutePath() ) )
+ if ( !project.getCompileSourceRoots().contains( outputDirectory.getAbsolutePath() ) && !skip )
{
project.addCompileSourceRoot( outputDirectory.getAbsolutePath() );
}
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
index 6d3319d..75b1e16 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
@@ -131,6 +131,22 @@ public class PluginReport
*/
protected String goalPrefix;
+ /**
+ * Set this to "true" to skip invoking any goals or reports of the plugin.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.skip}"
+ * @since 2.8
+ */
+ private boolean skip;
+
+ /**
+ * Set this to "true" to skip generating the report.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.report.skip}"
+ * @since 2.8
+ */
+ private boolean skipReport;
+
/** {@inheritDoc} */
protected Renderer getSiteRenderer()
{
@@ -163,6 +179,11 @@ public class PluginReport
{
return;
}
+ if (skip || skipReport)
+ {
+ getLog().info( "Maven Plugin Plugin Report generation skipped." );
+ return;
+ }
// Copy from AbstractGeneratorMojo#execute()
String defaultGoalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() );
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
index a04e667..ff24f28 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java
@@ -94,12 +94,33 @@ public class UpdatePluginRegistryMojo
*/
private MavenPluginRegistryBuilder pluginRegistryBuilder;
+ /**
+ * Set this to "true" to skip invoking any goals or reports of the plugin.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.skip}"
+ * @since 2.8
+ */
+ private boolean skip;
+
+ /**
+ * Set this to "true" to skip updating the plugin registry.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.update.registry.skip}"
+ * @since 2.8
+ */
+ private boolean skipUpdatePluginRegistry;
+
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException, MojoFailureException
{
if ( usePluginRegistry )
{
+ if ( skip || skipUpdatePluginRegistry )
+ {
+ getLog().warn( "Execution skipped" );
+ return;
+ }
updatePluginVersionInRegistry( groupId, artifactId, version );
}
}
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
index 1adb230..005206d 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java
@@ -58,10 +58,23 @@ public class AddPluginArtifactMetadataMojo
*/
private String goalPrefix;
+ /**
+ * Set this to "true" to skip invoking any goals or reports of the plugin.
+ *
+ * @parameter default-value="false" expression="${maven.plugin.skip}"
+ * @since 2.8
+ */
+ private boolean skip;
+
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
{
+ if ( skip )
+ {
+ getLog().warn( "Execution skipped" );
+ return;
+ }
Artifact projectArtifact = project.getArtifact();
Versioning versioning = new Versioning();