diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml
index d45bb6b..b433833 100644
--- a/maven-plugin-plugin/pom.xml
+++ b/maven-plugin-plugin/pom.xml
@@ -167,6 +167,13 @@
+
+ org.apache.maven.surefire
+ maven-surefire-common
+ 2.19.1
+
+
+
org.apache.velocity
diff --git a/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/invoker.properties b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/invoker.properties
new file mode 100644
index 0000000..1b464c5
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/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 process-classes
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/pom.xml b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/pom.xml
new file mode 100644
index 0000000..14dba07
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/pom.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.plugin.its
+ mplugin305
+ 1.0-SNAPSHOT
+ maven-plugin
+
+ https://issues.apache.org/jira/browse/MPLUGIN-305
+
+
+ @project.version@
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.2.1
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${mavenPluginPluginVersion}
+ provided
+
+
+ org.apache.maven.surefire
+ maven-surefire-common
+ 2.19.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.4
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ ${mavenPluginPluginVersion}
+
+
+ java-annotations
+
+ true
+
+
+
+ mojo-descriptor
+
+ descriptor
+
+
+
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
new file mode 100644
index 0000000..838faea
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
@@ -0,0 +1,289 @@
+package org.apache.maven.plugins.plugin.it;
+
+/*
+ * 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 java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.surefire.suite.RunResult;
+
+@Mojo(name="custom-surefire")
+public class CustomSurefireMojo extends AbstractSurefireMojo {
+
+ public File getBasedir()
+ {
+ return null;
+ }
+
+ public File getClassesDirectory()
+ {
+ return null;
+ }
+
+ public String getDebugForkedProcess()
+ {
+ return null;
+ }
+
+ public Boolean getFailIfNoSpecifiedTests()
+ {
+ return null;
+ }
+
+ public int getForkedProcessTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutForcedInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public String getReportFormat()
+ {
+ return null;
+ }
+
+ public File getReportsDirectory()
+ {
+ return null;
+ }
+
+ public String getShutdown()
+ {
+ return null;
+ }
+
+ public int getSkipAfterFailureCount()
+ {
+ return 0;
+ }
+
+ public String getTest()
+ {
+ return null;
+ }
+
+ public File getTestClassesDirectory()
+ {
+ return null;
+ }
+
+ public boolean isPrintSummary()
+ {
+ return false;
+ }
+
+ public boolean isSkip()
+ {
+ return false;
+ }
+
+ public boolean isSkipExec()
+ {
+ return false;
+ }
+
+ public boolean isSkipTests()
+ {
+ return false;
+ }
+
+ public boolean isUseFile()
+ {
+ return false;
+ }
+
+ public boolean isUseManifestOnlyJar()
+ {
+ return false;
+ }
+
+ public boolean isUseSystemClassLoader()
+ {
+ return false;
+ }
+
+ public void setBasedir( File arg0 )
+ {
+ }
+
+ public void setClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setDebugForkedProcess( String arg0 )
+ {
+ }
+
+ public void setFailIfNoSpecifiedTests( boolean arg0 )
+ {
+ }
+
+ public void setForkedProcessTimeoutInSeconds( int arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutForcedInSeconds( double arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutInSeconds( double arg0 )
+ {
+ }
+
+ public void setPrintSummary( boolean arg0 )
+ {
+ }
+
+ public void setReportFormat( String arg0 )
+ {
+ }
+
+ public void setReportsDirectory( File arg0 )
+ {
+ }
+
+ public void setSkip( boolean arg0 )
+ {
+ }
+
+ public void setSkipExec( boolean arg0 )
+ {
+ }
+
+ public void setSkipTests( boolean arg0 )
+ {
+ }
+
+ public void setTest( String arg0 )
+ {
+ }
+
+ public void setTestClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setUseFile( boolean arg0 )
+ {
+ }
+
+ public void setUseManifestOnlyJar( boolean arg0 )
+ {
+ }
+
+ public void setUseSystemClassLoader( boolean arg0 )
+ {
+ }
+
+ @Override
+ protected String[] getDefaultIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getExcludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ public List getIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getIncludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getPluginName()
+ {
+ return null;
+ }
+
+ @Override
+ protected int getRerunFailingTestsCount()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getRunOrder()
+ {
+ return null;
+ }
+
+ @Override
+ public File[] getSuiteXmlFiles()
+ {
+ return null;
+ }
+
+ @Override
+ protected void handleSummary( RunResult arg0, Exception arg1 )
+ {
+ }
+
+ @Override
+ protected boolean hasSuiteXmlFiles()
+ {
+ return false;
+ }
+
+ @Override
+ protected boolean isSkipExecution()
+ {
+ return false;
+ }
+
+ @Override
+ public void setIncludes( List arg0 )
+ {
+ }
+
+ @Override
+ public void setRunOrder( String arg0 )
+ {
+ }
+
+ @Override
+ public void setSuiteXmlFiles( File[] arg0 )
+ {
+ }
+
+ @Override
+ protected List suiteXmlFiles()
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/verify.groovy b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/verify.groovy
new file mode 100644
index 0000000..d5f6874
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_defaultMojoDependencies/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 );
+
+assert pluginDescriptor.mojos.mojo.size() == 1
+assert pluginDescriptor.mojos.mojo.parameters.parameter.size() == 50
+
+return true;
diff --git a/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/invoker.properties b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/invoker.properties
new file mode 100644
index 0000000..1b464c5
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/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 process-classes
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/pom.xml b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/pom.xml
new file mode 100644
index 0000000..3dc28ca
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.plugin.its
+ mplugin305
+ 1.0-SNAPSHOT
+ maven-plugin
+
+ https://issues.apache.org/jira/browse/MPLUGIN-305
+
+
+ @project.version@
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.2.1
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${mavenPluginPluginVersion}
+ provided
+
+
+ org.apache.maven.surefire
+ maven-surefire-common
+ 2.19.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.4
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ ${mavenPluginPluginVersion}
+
+
+ java-annotations
+
+ true
+
+
+
+ mojo-descriptor
+
+ descriptor
+
+
+
+
+
+
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
new file mode 100644
index 0000000..838faea
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
@@ -0,0 +1,289 @@
+package org.apache.maven.plugins.plugin.it;
+
+/*
+ * 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 java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.surefire.suite.RunResult;
+
+@Mojo(name="custom-surefire")
+public class CustomSurefireMojo extends AbstractSurefireMojo {
+
+ public File getBasedir()
+ {
+ return null;
+ }
+
+ public File getClassesDirectory()
+ {
+ return null;
+ }
+
+ public String getDebugForkedProcess()
+ {
+ return null;
+ }
+
+ public Boolean getFailIfNoSpecifiedTests()
+ {
+ return null;
+ }
+
+ public int getForkedProcessTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutForcedInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public String getReportFormat()
+ {
+ return null;
+ }
+
+ public File getReportsDirectory()
+ {
+ return null;
+ }
+
+ public String getShutdown()
+ {
+ return null;
+ }
+
+ public int getSkipAfterFailureCount()
+ {
+ return 0;
+ }
+
+ public String getTest()
+ {
+ return null;
+ }
+
+ public File getTestClassesDirectory()
+ {
+ return null;
+ }
+
+ public boolean isPrintSummary()
+ {
+ return false;
+ }
+
+ public boolean isSkip()
+ {
+ return false;
+ }
+
+ public boolean isSkipExec()
+ {
+ return false;
+ }
+
+ public boolean isSkipTests()
+ {
+ return false;
+ }
+
+ public boolean isUseFile()
+ {
+ return false;
+ }
+
+ public boolean isUseManifestOnlyJar()
+ {
+ return false;
+ }
+
+ public boolean isUseSystemClassLoader()
+ {
+ return false;
+ }
+
+ public void setBasedir( File arg0 )
+ {
+ }
+
+ public void setClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setDebugForkedProcess( String arg0 )
+ {
+ }
+
+ public void setFailIfNoSpecifiedTests( boolean arg0 )
+ {
+ }
+
+ public void setForkedProcessTimeoutInSeconds( int arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutForcedInSeconds( double arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutInSeconds( double arg0 )
+ {
+ }
+
+ public void setPrintSummary( boolean arg0 )
+ {
+ }
+
+ public void setReportFormat( String arg0 )
+ {
+ }
+
+ public void setReportsDirectory( File arg0 )
+ {
+ }
+
+ public void setSkip( boolean arg0 )
+ {
+ }
+
+ public void setSkipExec( boolean arg0 )
+ {
+ }
+
+ public void setSkipTests( boolean arg0 )
+ {
+ }
+
+ public void setTest( String arg0 )
+ {
+ }
+
+ public void setTestClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setUseFile( boolean arg0 )
+ {
+ }
+
+ public void setUseManifestOnlyJar( boolean arg0 )
+ {
+ }
+
+ public void setUseSystemClassLoader( boolean arg0 )
+ {
+ }
+
+ @Override
+ protected String[] getDefaultIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getExcludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ public List getIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getIncludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getPluginName()
+ {
+ return null;
+ }
+
+ @Override
+ protected int getRerunFailingTestsCount()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getRunOrder()
+ {
+ return null;
+ }
+
+ @Override
+ public File[] getSuiteXmlFiles()
+ {
+ return null;
+ }
+
+ @Override
+ protected void handleSummary( RunResult arg0, Exception arg1 )
+ {
+ }
+
+ @Override
+ protected boolean hasSuiteXmlFiles()
+ {
+ return false;
+ }
+
+ @Override
+ protected boolean isSkipExecution()
+ {
+ return false;
+ }
+
+ @Override
+ public void setIncludes( List arg0 )
+ {
+ }
+
+ @Override
+ public void setRunOrder( String arg0 )
+ {
+ }
+
+ @Override
+ public void setSuiteXmlFiles( File[] arg0 )
+ {
+ }
+
+ @Override
+ protected List suiteXmlFiles()
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/verify.groovy b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/verify.groovy
new file mode 100644
index 0000000..f020e46
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_emptyMojoDependencies/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 );
+
+assert pluginDescriptor.mojos.mojo.size() == 1
+assert pluginDescriptor.mojos.mojo.parameters.parameter.size() == 0
+
+return true;
diff --git a/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/invoker.properties b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/invoker.properties
new file mode 100644
index 0000000..1b464c5
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/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 process-classes
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/pom.xml b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/pom.xml
new file mode 100644
index 0000000..600dcc7
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.plugin.its
+ mplugin305
+ 1.0-SNAPSHOT
+ maven-plugin
+
+ https://issues.apache.org/jira/browse/MPLUGIN-305
+
+
+ @project.version@
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.2.1
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ ${mavenPluginPluginVersion}
+ provided
+
+
+ org.apache.maven.surefire
+ maven-surefire-common
+ 2.19.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.4
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ ${mavenPluginPluginVersion}
+
+
+ java-annotations
+
+ true
+
+ org.apache.maven.surefire:maven-surefire-common
+
+
+
+
+ mojo-descriptor
+
+ descriptor
+
+
+
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
new file mode 100644
index 0000000..838faea
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/src/main/java/org/apache/maven/plugins/plugin/it/CustomSurefireMojo.java
@@ -0,0 +1,289 @@
+package org.apache.maven.plugins.plugin.it;
+
+/*
+ * 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 java.io.File;
+import java.util.List;
+
+import org.apache.maven.plugin.surefire.AbstractSurefireMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.surefire.suite.RunResult;
+
+@Mojo(name="custom-surefire")
+public class CustomSurefireMojo extends AbstractSurefireMojo {
+
+ public File getBasedir()
+ {
+ return null;
+ }
+
+ public File getClassesDirectory()
+ {
+ return null;
+ }
+
+ public String getDebugForkedProcess()
+ {
+ return null;
+ }
+
+ public Boolean getFailIfNoSpecifiedTests()
+ {
+ return null;
+ }
+
+ public int getForkedProcessTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutForcedInSeconds()
+ {
+ return 0;
+ }
+
+ public double getParallelTestsTimeoutInSeconds()
+ {
+ return 0;
+ }
+
+ public String getReportFormat()
+ {
+ return null;
+ }
+
+ public File getReportsDirectory()
+ {
+ return null;
+ }
+
+ public String getShutdown()
+ {
+ return null;
+ }
+
+ public int getSkipAfterFailureCount()
+ {
+ return 0;
+ }
+
+ public String getTest()
+ {
+ return null;
+ }
+
+ public File getTestClassesDirectory()
+ {
+ return null;
+ }
+
+ public boolean isPrintSummary()
+ {
+ return false;
+ }
+
+ public boolean isSkip()
+ {
+ return false;
+ }
+
+ public boolean isSkipExec()
+ {
+ return false;
+ }
+
+ public boolean isSkipTests()
+ {
+ return false;
+ }
+
+ public boolean isUseFile()
+ {
+ return false;
+ }
+
+ public boolean isUseManifestOnlyJar()
+ {
+ return false;
+ }
+
+ public boolean isUseSystemClassLoader()
+ {
+ return false;
+ }
+
+ public void setBasedir( File arg0 )
+ {
+ }
+
+ public void setClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setDebugForkedProcess( String arg0 )
+ {
+ }
+
+ public void setFailIfNoSpecifiedTests( boolean arg0 )
+ {
+ }
+
+ public void setForkedProcessTimeoutInSeconds( int arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutForcedInSeconds( double arg0 )
+ {
+ }
+
+ public void setParallelTestsTimeoutInSeconds( double arg0 )
+ {
+ }
+
+ public void setPrintSummary( boolean arg0 )
+ {
+ }
+
+ public void setReportFormat( String arg0 )
+ {
+ }
+
+ public void setReportsDirectory( File arg0 )
+ {
+ }
+
+ public void setSkip( boolean arg0 )
+ {
+ }
+
+ public void setSkipExec( boolean arg0 )
+ {
+ }
+
+ public void setSkipTests( boolean arg0 )
+ {
+ }
+
+ public void setTest( String arg0 )
+ {
+ }
+
+ public void setTestClassesDirectory( File arg0 )
+ {
+ }
+
+ public void setUseFile( boolean arg0 )
+ {
+ }
+
+ public void setUseManifestOnlyJar( boolean arg0 )
+ {
+ }
+
+ public void setUseSystemClassLoader( boolean arg0 )
+ {
+ }
+
+ @Override
+ protected String[] getDefaultIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getExcludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ public List getIncludes()
+ {
+ return null;
+ }
+
+ @Override
+ public File getIncludesFile()
+ {
+ return null;
+ }
+
+ @Override
+ protected String getPluginName()
+ {
+ return null;
+ }
+
+ @Override
+ protected int getRerunFailingTestsCount()
+ {
+ return 0;
+ }
+
+ @Override
+ public String getRunOrder()
+ {
+ return null;
+ }
+
+ @Override
+ public File[] getSuiteXmlFiles()
+ {
+ return null;
+ }
+
+ @Override
+ protected void handleSummary( RunResult arg0, Exception arg1 )
+ {
+ }
+
+ @Override
+ protected boolean hasSuiteXmlFiles()
+ {
+ return false;
+ }
+
+ @Override
+ protected boolean isSkipExecution()
+ {
+ return false;
+ }
+
+ @Override
+ public void setIncludes( List arg0 )
+ {
+ }
+
+ @Override
+ public void setRunOrder( String arg0 )
+ {
+ }
+
+ @Override
+ public void setSuiteXmlFiles( File[] arg0 )
+ {
+ }
+
+ @Override
+ protected List suiteXmlFiles()
+ {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/verify.groovy b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/verify.groovy
new file mode 100644
index 0000000..d5f6874
--- /dev/null
+++ b/maven-plugin-plugin/src/it/mplugin-305_singleMojoDependencies/verify.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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 );
+
+assert pluginDescriptor.mojos.mojo.size() == 1
+assert pluginDescriptor.mojos.mojo.parameters.parameter.size() == 50
+
+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 c3f93eb..8b709b7 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
@@ -21,6 +21,8 @@ package org.apache.maven.plugin.plugin;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
@@ -40,6 +42,7 @@ import org.codehaus.plexus.util.ReaderFactory;
import java.io.File;
import java.util.Arrays;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -129,6 +132,16 @@ public abstract class AbstractGeneratorMojo
*/
@Parameter( defaultValue = "${project.artifacts}", required = true, readonly = true )
protected Set dependencies;
+
+ /**
+ * Specify the dependencies as {@code groupId:artifactId} containing (abstract) Mojos.
+ * If none is specified, all dependencies are scanned.
+ * If an empty list is specified, no dependencies are scanned.
+ *
+ * @since 3.5
+ */
+ @Parameter
+ private List mojoDependencies;
/**
* List of Remote Repositories used by the resolver
@@ -230,6 +243,31 @@ public abstract class AbstractGeneratorMojo
getLog().info( "Using '" + encoding + "' encoding to read mojo source files." );
}
+ Set requestDependencies;
+ if ( mojoDependencies == null )
+ {
+ requestDependencies = dependencies;
+ }
+ else if ( mojoDependencies == null )
+ {
+ requestDependencies = null;
+ }
+ else
+ {
+ requestDependencies = new LinkedHashSet();
+
+ ArtifactFilter filter = new IncludesArtifactFilter( mojoDependencies );
+
+ for ( Artifact artifact : dependencies )
+ {
+ if ( filter.include( artifact ) )
+ {
+ requestDependencies.add( artifact );
+ }
+ }
+ }
+
+
try
{
List deps = GeneratorUtils.toComponentDependencies( project.getRuntimeDependencies() );
@@ -238,7 +276,7 @@ public abstract class AbstractGeneratorMojo
PluginToolsRequest request = new DefaultPluginToolsRequest( project, pluginDescriptor );
request.setEncoding( encoding );
request.setSkipErrorNoDescriptorsFound( skipErrorNoDescriptorsFound );
- request.setDependencies( dependencies );
+ request.setDependencies( requestDependencies );
request.setLocal( this.local );
request.setRemoteRepos( this.remoteRepos );