diff --git a/maven-plugin-plugin/src/it/packaging-jar/invoker.properties b/maven-plugin-plugin/src/it/packaging-jar/invoker.properties
new file mode 100644
index 0000000..43be5b1
--- /dev/null
+++ b/maven-plugin-plugin/src/it/packaging-jar/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals.1 = clean install
diff --git a/maven-plugin-plugin/src/it/packaging-jar/pom.xml b/maven-plugin-plugin/src/it/packaging-jar/pom.xml
new file mode 100644
index 0000000..ebaeba7
--- /dev/null
+++ b/maven-plugin-plugin/src/it/packaging-jar/pom.xml
@@ -0,0 +1,102 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.packaging-jar
+ packaging-jar
+ 1.0-SNAPSHOT
+ jar
+
+ Maven Integration Test :: packaging-jar
+
+ Test plugin-plugin can be enabled for projects with alternative packaging types,
+ "jar" in this particular case.
+
+
+
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.2.1
+
+
+ org.apache.maven
+ maven-core
+ 2.2.1
+
+
+ org.codehaus.plexus
+ plexus-utils
+ 3.0.1
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ @project.version@
+ compile
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.4
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ @project.version@
+
+ true
+
+ jar
+
+
+
+
+ mojo-descriptor
+
+ descriptor
+
+
+
+ help-goal
+
+ helpmojo
+
+
+
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/packaging-jar/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java b/maven-plugin-plugin/src/it/packaging-jar/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
new file mode 100644
index 0000000..bb31a86
--- /dev/null
+++ b/maven-plugin-plugin/src/it/packaging-jar/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
@@ -0,0 +1,35 @@
+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 org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * @deprecated Don't use!
+ */
+@Mojo( name = "first" )
+public class FirstMojo
+ extends AbstractMojo
+{
+
+ public void execute()
+ throws MojoExecutionException
+ {
+ }
+
+}
diff --git a/maven-plugin-plugin/src/it/packaging-jar/verify.groovy b/maven-plugin-plugin/src/it/packaging-jar/verify.groovy
new file mode 100644
index 0000000..3883bb4
--- /dev/null
+++ b/maven-plugin-plugin/src/it/packaging-jar/verify.groovy
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" );
+assert descriptorFile.isFile()
+
+def pluginDescriptor = new XmlParser().parse( descriptorFile );
+
+def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first" }[0]
+
+assert mojo.goal.text() == 'first'
+assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
+assert mojo.language.text() == 'java'
+
+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 45569f6..7f9e972 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
@@ -38,6 +38,7 @@ import org.apache.maven.tools.plugin.scanner.MojoScanner;
import org.codehaus.plexus.util.ReaderFactory;
import java.io.File;
+import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -144,6 +145,14 @@ public abstract class AbstractGeneratorMojo
@Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
protected ArtifactRepository local;
+ /**
+ * Maven plugin packaging types. Default is single "maven-plugin".
+ *
+ * @since 3.3
+ */
+ @Parameter
+ protected List packagingTypes = Arrays.asList( "maven-plugin" );
+
/**
* @return the output directory where files will be generated.
*/
@@ -160,8 +169,9 @@ public abstract class AbstractGeneratorMojo
public void execute()
throws MojoExecutionException
{
- if ( !"maven-plugin".equals( project.getPackaging() ) )
+ if ( !packagingTypes.contains( project.getPackaging() ) )
{
+ getLog().warn( "Unsupported packaging type " + project.getPackaging() + ", execution skipped" );
return;
}
if ( skip )