[MPLUGIN-231] Switch to plugin annotations for the generated help-mojo if the Maven Plugin depends on maven-plugin-annotations

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1405379 13f79535-47bb-0310-9956-ffa450edef68
master
Robert Scholte 2012-11-03 16:42:01 +00:00
parent 0435027899
commit 6e6ee108b7
2 changed files with 14 additions and 3 deletions

View File

@ -19,17 +19,18 @@ package org.apache.maven.plugin.plugin;
* under the License. * under the License.
*/ */
import java.io.File;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.tools.plugin.generator.Generator; import org.apache.maven.tools.plugin.generator.Generator;
import org.apache.maven.tools.plugin.generator.PluginHelpGenerator; import org.apache.maven.tools.plugin.generator.PluginHelpGenerator;
import org.codehaus.plexus.velocity.VelocityComponent; import org.codehaus.plexus.velocity.VelocityComponent;
import java.io.File;
/** /**
* Generates a <code>HelpMojo</code> class. * Generates a <code>HelpMojo</code> class.
* *
@ -37,7 +38,7 @@ import java.io.File;
* @version $Id$ * @version $Id$
* @since 2.4 * @since 2.4
*/ */
@Mojo( name = "helpmojo", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true /*, requiresDependencyResolution = ResolutionScope.COMPILE */ ) @Mojo( name = "helpmojo", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE )
public class HelpGeneratorMojo public class HelpGeneratorMojo
extends AbstractGeneratorMojo extends AbstractGeneratorMojo
{ {

View File

@ -4,6 +4,11 @@ package ${helpPackageName};
import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
#if ( $useAnnotations )
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
#end
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
@ -24,10 +29,15 @@ import java.util.List;
* Call <code>mvn ${goalPrefix}:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</code> to display parameter details. * Call <code>mvn ${goalPrefix}:help -Ddetail=true -Dgoal=&lt;goal-name&gt;</code> to display parameter details.
* @author * @author
* @version * @version
#if ( !$useAnnotations )
* @goal help * @goal help
* @requiresProject false * @requiresProject false
* @threadSafe * @threadSafe
#end
*/ */
#if ( $useAnnotations )
@Mojo( name = "help", requiresProject = false, threadSafe = true )
#end
public class HelpMojo public class HelpMojo
extends AbstractMojo extends AbstractMojo
{ {