diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml
index 1475eb7..c8c0300 100644
--- a/maven-plugin-plugin/pom.xml
+++ b/maven-plugin-plugin/pom.xml
@@ -62,6 +62,7 @@
2.0.6
1.2
1.2
+ true
@@ -292,6 +293,7 @@
${project.build.directory}/it
${project.build.directory}/local-repo
+ ${it.debug}
3.0
diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/invoker.properties b/maven-plugin-plugin/src/it/java-basic-annotations/invoker.properties
new file mode 100644
index 0000000..e8db4c3
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/invoker.properties
@@ -0,0 +1,2 @@
+invoker.goals.1 = install
+invoker.goals.2 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0:it0014
diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml b/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml
new file mode 100644
index 0000000..6a95441
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/pom.xml
@@ -0,0 +1,75 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.basic-java-annotations
+ maven-it-basic-java-annotations
+ 1.0
+ maven-plugin
+
+ Maven Integration Test :: basic-java-annotations
+
+ Test plugin-plugin, which tests maven-plugin-tools-api and
+ maven-plugin-tools-java. This will generate a plugin descriptor from
+ java-based mojo sources, install the plugin, and then use it.
+
+
+
+ UTF-8
+
+
+
+
+ org.apache.maven
+ maven-plugin-api
+ 2.0
+
+
+ org.apache.maven.plugin-tools
+ maven-plugin-annotations
+ @project.version@
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-plugin-plugin
+ @project.version@
+
+ true
+
+
+
+
+ descriptor
+
+ mojo-descriptor
+ process-classes
+
+
+
+
+
+
diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
new file mode 100644
index 0000000..b6dc2fa
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
@@ -0,0 +1,66 @@
+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;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Touches a test file.
+ *
+ */
+@Mojo( name = "it0014")
+public class CoreIt0014Mojo
+ extends AbstractMojo
+{
+
+ @Parameter(expression ="${project.build.directory}", required = true)
+ 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/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
new file mode 100644
index 0000000..cee401d
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
@@ -0,0 +1,66 @@
+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.Component;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.io.File;
+
+/**
+ * Touches a test file.
+ *
+ * @since 1.2
+ * @deprecated Don't use!
+ */
+@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST )
+@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
+public class FirstMojo
+ extends AbstractMojo
+{
+
+ @Parameter( defaultValue = "${basedir}", readonly = true )
+ private File basedir;
+
+ @Parameter( expression = "${first.touchFile}", defaultValue = "${project.build.directory}/touch.txt",
+ required = true )
+ private File touchFile;
+
+ /**
+ * @since 0.1
+ * @deprecated As of 0.2
+ */
+ @Parameter( alias = "alias" )
+ 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/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
new file mode 100644
index 0000000..8e28eba
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
@@ -0,0 +1,38 @@
+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.plugins.annotations.Mojo;
+
+/**
+ * Does nothing special.
+ *
+ */
+@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
+public class SecondMojo
+ extends AbstractMojo
+{
+
+ public void execute()
+ {
+ }
+
+}
diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
new file mode 100644
index 0000000..3d274c5
--- /dev/null
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
@@ -0,0 +1,72 @@
+File touchFile = new File( basedir, "target/touch.txt" )
+assert touchFile.isFile()
+
+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'
+assert mojo.description.text() == 'Touches a test file.'
+assert mojo.deprecated.text() == "Don't use!"
+assert mojo.requiresDependencyResolution.text() == 'test'
+assert mojo.requiresDependencyCollection.text() == ''
+assert mojo.requiresProject.text() == 'true'
+assert mojo.requiresOnline.text() == 'false'
+assert mojo.requiresDirectInvocation.text() == 'false'
+assert mojo.aggregator.text() == 'false'
+assert mojo.threadSafe.text() == 'false'
+assert mojo.phase.text() == 'integration-test'
+assert mojo.executePhase.text() == 'generate-sources'
+assert mojo.executeLifecycle.text() == 'cobertura'
+
+assert mojo.configuration.basedir[0].text() == ''
+assert mojo.configuration.basedir[0].'@implementation' == 'java.io.File'
+assert mojo.configuration.basedir[0].'@default-value' == '${basedir}'
+
+assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
+assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
+assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'
+
+assert mojo.requirements.requirement.size() == 1
+
+assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
+assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
+assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
+
+assert mojo.parameters.parameter.size() == 3
+
+assert mojo.parameters.parameter[0].name.text() == 'aliasedParam'
+assert mojo.parameters.parameter[0].alias.text() == 'alias'
+assert mojo.parameters.parameter[0].type.text() == 'java.lang.String'
+assert mojo.parameters.parameter[0].deprecated.text() == 'As of 0.2'
+assert mojo.parameters.parameter[0].required.text() == 'false'
+assert mojo.parameters.parameter[0].editable.text() == 'true'
+assert mojo.parameters.parameter[0].description.text() == ''
+
+assert mojo.parameters.parameter[1].name.text() == 'basedir'
+assert mojo.parameters.parameter[1].alias.isEmpty()
+assert mojo.parameters.parameter[1].type.text() == 'java.io.File'
+assert mojo.parameters.parameter[1].deprecated.isEmpty()
+assert mojo.parameters.parameter[1].required.text() == 'false'
+assert mojo.parameters.parameter[1].editable.text() == 'false'
+assert mojo.parameters.parameter[1].description.text() == 'Project directory.'
+
+assert mojo.parameters.parameter[2].name.text() == 'touchFile'
+assert mojo.parameters.parameter[2].alias.isEmpty()
+assert mojo.parameters.parameter[2].type.text() == 'java.io.File'
+assert mojo.parameters.parameter[2].deprecated.isEmpty()
+assert mojo.parameters.parameter[2].required.text() == 'true'
+assert mojo.parameters.parameter[2].editable.text() == 'true'
+assert mojo.parameters.parameter[2].description.text() == ''
+
+mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
+
+assert mojo.requiresDependencyCollection.text() == 'compile'
+assert mojo.threadSafe.text() == 'true'
+
+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 13d1704..00702a6 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
@@ -79,6 +79,15 @@ public abstract class AbstractGeneratorMojo
*/
protected String goalPrefix;
+ /**
+ * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
+ * descriptor generator mojo is bound to generate-resources phase.
+ * But for annotations, the compiled classes are needed, so skip error
+ * @parameter expression="${maven.plugin.skipErrorNoDescriptorsFound}" default-value="false"
+ * @since 3.0
+ */
+ protected boolean skipErrorNoDescriptorsFound;
+
/**
* The role names of mojo extractors to use.
*
@@ -193,6 +202,7 @@ public abstract class AbstractGeneratorMojo
PluginToolsRequest request = new DefaultPluginToolsRequest( project, pluginDescriptor );
request.setEncoding( encoding );
+ request.setSkipErrorNoDescriptorsFound( skipErrorNoDescriptorsFound );
mojoScanner.populatePluginDescriptor( request );
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
index 9c63dd3..a125363 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
@@ -34,7 +34,7 @@ import java.io.File;
* @version $Id$
* @since 2.0
* @goal descriptor
- * @phase generate-resources
+ * @phase process-classes
* @requiresDependencyResolution runtime
*/
public class DescriptorGeneratorMojo
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 1bac881..bf20432 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
@@ -32,7 +32,7 @@ import org.apache.maven.tools.plugin.generator.PluginHelpGenerator;
* @version $Id$
* @since 2.4
* @goal helpmojo
- * @phase generate-sources
+ * @phase process-classes
*/
public class HelpGeneratorMojo
extends AbstractGeneratorMojo
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
index b9cf49e..0fa534c 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
@@ -79,7 +79,7 @@ public class JavaAnnotationsMojoDescriptorExtractor
List mojoAnnotatedClasses =
mojoAnnotationsScanner.scan( mojoAnnotationsScannerRequest );
- return toMojoDescriptors( mojoAnnotatedClasses );
+ return toMojoDescriptors( mojoAnnotatedClasses, request );
}
catch ( DependencyResolutionRequiredException e )
{
@@ -101,7 +101,8 @@ public class JavaAnnotationsMojoDescriptorExtractor
return files;
}
- private List toMojoDescriptors( List mojoAnnotatedClasses )
+ private List toMojoDescriptors( List mojoAnnotatedClasses,
+ PluginToolsRequest request )
throws DuplicateParameterException
{
List mojoDescriptors = new ArrayList( mojoAnnotatedClasses.size() );
@@ -109,17 +110,25 @@ public class JavaAnnotationsMojoDescriptorExtractor
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
+ //mojoDescriptor.setRole( mojoAnnotatedClass.getClassName() );
+ //mojoDescriptor.setRoleHint( "default" );
+ mojoDescriptor.setImplementation( mojoAnnotatedClass.getClassName() );
+
MojoAnnotationContent mojo = mojoAnnotatedClass.getMojo();
- ExecuteAnnotationContent execute = mojoAnnotatedClass.getExecute();
mojoDescriptor.setAggregator( mojo.aggregator() );
mojoDescriptor.setDependencyResolutionRequired( mojo.requiresDependencyResolution() );
mojoDescriptor.setDirectInvocationOnly( mojo.requiresDirectInvocation() );
mojoDescriptor.setDeprecated( mojo.getDeprecated() );
- mojoDescriptor.setExecuteGoal( execute.goal() );
- mojoDescriptor.setExecuteLifecycle( execute.lifecycle() );
- mojoDescriptor.setExecutePhase( execute.phase().id() );
+ ExecuteAnnotationContent execute = mojoAnnotatedClass.getExecute();
+
+ if ( execute != null )
+ {
+ mojoDescriptor.setExecuteGoal( execute.goal() );
+ mojoDescriptor.setExecuteLifecycle( execute.lifecycle() );
+ mojoDescriptor.setExecutePhase( execute.phase().id() );
+ }
mojoDescriptor.setExecutionStrategy( mojo.executionStrategy() );
// FIXME olamy wtf ?
@@ -157,6 +166,8 @@ public class JavaAnnotationsMojoDescriptorExtractor
mojoDescriptor.addParameter( parameter );
}
+ mojoDescriptor.setPluginDescriptor( request.getPluginDescriptor() );
+
mojoDescriptors.add( mojoDescriptor );
}
return mojoDescriptors;
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java
index 18aeecc..5fee961 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ComponentAnnotationContent.java
@@ -49,7 +49,7 @@ public class ComponentAnnotationContent
public String role()
{
- return role;
+ return role == null ? "" : role;
}
public void role( String role )
@@ -59,7 +59,7 @@ public class ComponentAnnotationContent
public String roleHint()
{
- return roleHint;
+ return roleHint == null ? "" : roleHint;
}
public void roleHint( String roleHint )
diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/DefaultPluginToolsRequest.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/DefaultPluginToolsRequest.java
index fdbaa7f..fd6a60e 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/DefaultPluginToolsRequest.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/DefaultPluginToolsRequest.java
@@ -44,6 +44,8 @@ public class DefaultPluginToolsRequest
private String encoding = DEFAULT_ENCODING;
+ private boolean skipErrorNoDescriptorsFound;
+
public DefaultPluginToolsRequest( MavenProject project, PluginDescriptor pluginDescriptor )
{
this.project = project;
@@ -109,4 +111,20 @@ public class DefaultPluginToolsRequest
return this;
}
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isSkipErrorNoDescriptorsFound()
+ {
+ return skipErrorNoDescriptorsFound;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound )
+ {
+ this.skipErrorNoDescriptorsFound = skipErrorNoDescriptorsFound;
+ return this;
+ }
}
diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
index d670f12..531ad83 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/PluginToolsRequest.java
@@ -26,23 +26,23 @@ import org.apache.maven.project.MavenProject;
/**
* Request that encapsulates all information relevant to the process of extracting {@link MojoDescriptor}
* instances from metadata for a certain type of mojo.
- *
+ *
* @author jdcasey
* @since 2.5
*/
public interface PluginToolsRequest
{
-
+
/**
* Return the current {@link MavenProject} instance in use.
*/
MavenProject getProject();
-
+
/**
* @see PluginToolsRequest#getProject()
*/
PluginToolsRequest setProject( MavenProject project );
-
+
/**
* Return the {@link PluginDescriptor} currently being populated as part of the build of the
* current plugin project.
@@ -53,21 +53,37 @@ public interface PluginToolsRequest
* @see PluginToolsRequest#getPluginDescriptor()
*/
PluginToolsRequest setPluginDescriptor( PluginDescriptor pluginDescriptor );
-
+
/**
* Gets the file encoding of the source files.
- *
+ *
* @return The file encoding of the source files, never null.
*/
String getEncoding();
/**
* Sets the file encoding of the source files.
- *
+ *
* @param encoding The file encoding of the source files, may be empty or null to use the platform's
- * default encoding.
+ * default encoding.
* @return This request.
*/
PluginToolsRequest setEncoding( String encoding );
+ /**
+ * By default an exception is throw if no mojo descriptor is found. As the maven-plugin is defined in core, the
+ * descriptor generator mojo is bound to generate-resources phase.
+ * But for annotations, the compiled classes are needed, so skip error
+ * @since 3.0
+ */
+ PluginToolsRequest setSkipErrorNoDescriptorsFound( boolean skipErrorNoDescriptorsFound );
+
+ /**
+ * @since 3.0
+ * @return
+ */
+ boolean isSkipErrorNoDescriptorsFound();
+
+
+
}
diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
index 1d5d8a2..05a2b1c 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScanner.java
@@ -19,11 +19,6 @@ package org.apache.maven.tools.plugin.scanner;
* under the License.
*/
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
@@ -36,6 +31,11 @@ import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
/**
* @author jdcasey
*/
@@ -71,14 +71,18 @@ public class DefaultMojoScanner
// nop
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
public void populatePluginDescriptor( MavenProject project, PluginDescriptor pluginDescriptor )
throws ExtractionException, InvalidPluginDescriptorException
{
populatePluginDescriptor( new DefaultPluginToolsRequest( project, pluginDescriptor ) );
}
-
- /** {@inheritDoc} */
+
+ /**
+ * {@inheritDoc}
+ */
public void populatePluginDescriptor( PluginToolsRequest request )
throws ExtractionException, InvalidPluginDescriptorException
{
@@ -103,7 +107,7 @@ public class DefaultMojoScanner
List extractorDescriptors = extractor.execute( request );
logger.info( "Mojo extractor for language: " + language + " found " + extractorDescriptors.size()
- + " mojo descriptors." );
+ + " mojo descriptors." );
numMojoDescriptors += extractorDescriptors.size();
for ( MojoDescriptor descriptor : extractorDescriptors )
@@ -116,10 +120,11 @@ public class DefaultMojoScanner
}
}
- if ( numMojoDescriptors == 0 )
+ if ( numMojoDescriptors == 0 && !request.isSkipErrorNoDescriptorsFound() )
{
- throw new InvalidPluginDescriptorException( "No mojo definitions were found for plugin: "
- + request.getPluginDescriptor().getPluginLookupKey() + "." );
+ throw new InvalidPluginDescriptorException(
+ "No mojo definitions were found for plugin: " + request.getPluginDescriptor().getPluginLookupKey()
+ + "." );
}
}