Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: copied the documentation as of today http://maven.apache.org/plugin-tools-3.0-SNAPSHOT/maven-plugin-tools-annotations/

...

Annotations:

  • 4 annotations: @Mojo , and @Execute at class-level, @Parameter and @Component at field level
  • java package: org.apache.maven.tools.plugin.annotations (consistent with maven-plugin-tools-api
  • a new maven-plugin-tools-annotations component in plugin-tools

...

  • use annotations from parents classes coming from reactors and external dependencies.

Implementation

Work started in branch Initial work done in trunk http://svn.apache.org/repos/asf/maven/plugin-tools/branchestrunk/MPLUGIN-189/.

The maven-plugin-plugin version has been bump to 3.0-SNAPSHOT.

state as of 22/5/2012

Code Block
java
java

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.InstanciationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

/**
 * Mojo Description. @Mojo( name = "<goalName>" ) is the minimal required annotation.
 * @since <since-text>
 * @deprecated <deprecated-text>
 */
@Mojo( name = "<goalName>",
       aggregator = <false|true>, 
       configurator = "<roleHint>",
       executionStrategy = "<once-per-session|always>",
       inheritByDefault = <true|false>,
       instantiationStrategy = InstanciationStrategy.<strategy>,
       defaultPhase = "<phaseName>",
       requiresDependencyResolution = ResolutionScope.<scope>,
       requiresDependencyCollection = ResolutionScope.<scope>, // (since Maven 3.0)
       requiresDirectInvocation = <false|true>,
       requiresOnline = <false|true>,
       requiresProject = <true|false>,
       requiresReports = <false|true>, // (unsupported since Maven 3.0)
       threadSafe = <false|true> ) // (since Maven 3.0)
@Execute( goal = "<goalName>",
          phase = LifecyclePhase.<phase>
          lifecycle = "<lifecycleId>" )
public class MyMojo
    extends AbstractMojo
{
    /**
     * @since <since-text>
     * @deprecated <deprecated-text>
     */
    @Parameter( alias = "myAlias",
                property = "aProperty",
                defaultValue = "${anExpression}",
                readonly = <false|true>
                required = <false|true> )
    private String parameter;

    /**
     * @since <since-text>
     * @deprecated <deprecated-text>
     */
    @Component( role = "...",
                roleHint="..." )
    private MyComponent component;

    public void execute()
    {
        ...
    }
}