MyException - 我的异常网
当前位置:我的异常网» 研发管理 » maven插件java5诠注工具

maven插件java5诠注工具

www.MyException.Cn  网友分享于:2013-02-20  浏览:48次
maven插件java5注解工具

Mojo Javadoc Tags

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;

/**
 * Mojo Description: goal is the only required annotation.
 *
 * @goal <goalName>
 * @aggregator
 * @configurator <roleHint>
 * @execute phase="<phaseName>" lifecycle="<lifecycleId>" goal="<goalName>"
 * @executionStrategy <once-per-session|always>
 * @inheritByDefault <true|false>
 * @instantiationStrategy <per-lookup|singleton|keep-alive|poolable>
 * @phase <phaseName>
 * @requiresDependencyResolution <compile|runtime|compile+runtime|test>
 * @requiresDependencyCollection <compile|runtime|compile+runtime|test> (since Maven 3.0)
 * @requiresDirectInvocation <false|true>
 * @requiresOnline <false|true>
 * @requiresProject <true|false>
 * @requiresReports <false|true> (unsupported since Maven 3.0)
 * @threadSafe (since Maven 3.0)
 * @since <since-text>
 * @deprecated <deprecated-text>
 */
public class MyMojo
    extends AbstractMojo
{
    /**
     * @parameter alias="myAlias" implementation="" property="aProperty" default-value="${anExpression}"
     * @readonly
     * @required
     * @since <since-text>
     * @deprecated <deprecated-text>
     */
    private String parameter;

    /**
     * @component role="..." roleHint="..."
     */
    private Component component;

    /**
     * @component
     */
    private MavenSession session;

    /**
     * @component
     */
    private MavenProject project;

    /**
     * @component
     */
    private MojoExecution mojo;

    /**
     * @component
     */
    private PluginDescriptor plugin;

    /**
     * @component
     */
    private Settings settings;

    public void execute()
    {
        ...
    }
}

 

Annotations

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
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.InstantiationStrategy;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;

/**
 * Mojo Description. @Mojo( name = "<goal-name>" ) is the minimal required annotation.
 * @since <since-text>
 * @deprecated <deprecated-text>
 */
@Mojo( name = "<goal-name>",
       aggregator = <false|true>, 
       configurator = "<role hint>",
       executionStrategy = "<once-per-session|always>",
       inheritByDefault = <true|false>,
       instantiationStrategy = InstantiationStrategy.<strategy>,
       defaultPhase = "<phase-name>",
       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 = "<goal-name>",
          phase = LifecyclePhase.<phase>
          lifecycle = "<lifecycle-id>" )
public class MyMojo
    extends AbstractMojo
{
    /**
     * @since <since-text>
     * @deprecated <deprecated-text>
     */
    @Parameter( alias = "myAlias",
                property = "a.property",
                defaultValue = "an expression with ${variables} eventually",
                readonly = <false|true>
                required = <false|true> )
    private String parameter;

    @Component( role = MyComponentExtension.class,
                hint = "..." )
    private MyComponent component;

    @Component
    private MavenSession session;

    @Component
    private MavenProject project;

    @Component
    private MojoExecution mojo;

    @Component // for Maven 3 only
    private PluginDescriptor plugin;

    @Component
    private Settings settings;

    public void execute()
    {
        ...
    }
}

 

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有