java自定义maven插件_maven之自定义插件

/*** This annotation will mark your class as a Mojo (ie. goal in a Maven plugin).

*

*@authorOlivier Lamy

*@since3.0*/@Documented

@Retention( RetentionPolicy.CLASS )

@Target( ElementType.TYPE )

@Inheritedpublic @interfaceMojo

{/*** goal name (required).唯一必须声明的标注,当用户命令行调用或在pom中配置插件是,需使用该目标名称

*@returnthe goal name*/String name();/**默认将该目标绑定至default声明周期的某个阶段,这样在配置使用插件目标时,就无需声明phase,如maven-surefire-plugin的test目标带有@phase tes标注* default phase to bind your mojo.

*@returnthe default phase*/LifecyclePhase defaultPhase()defaultLifecyclePhase.NONE;/**在运行mojo之前必须解析所有指定范围的依赖,如maven-surefire-plugin的test目标带有requiresDependencyResolution test标注,表示执行测试前,所有测试范围的依赖必须得到解析* the required dependency resolution scope.

*@returnthe required dependency resolution scope*/ResolutionScope requiresDependencyResolution()defaultResolutionScope.NONE;/*** the required dependency collection scope.

*@returnthe required dependency collection scope*/ResolutionScope requiresDependencyCollection()defaultResolutionScope.NONE;/*** your Mojo instantiation strategy. (Only per-lookup and singleton are supported)

*@returnthe instantiation strategy*/InstantiationStrategy instantiationStrategy()defaultInstantiationStrategy.PER_LOOKUP;/*** execution strategy: once-per-session or always.

*@returnonce-per-session or always*/String executionStrategy()default "once-per-session";/**该目标是否必须在一个maven项目中运行(如测试插件用于测试其他项目),默认为true。大部分插件目标需依赖一个项目才能运行,但是,maven-help-plugin的system目标例外,它用来显示系统属性和环境变量信息,无需实际项目。* does your mojo requires a project to be executed?

*@returnrequires a project*/

boolean requiresProject() default true;/**是否要求项目报告已经生成,默认为false* does your mojo requires a reporting context to be executed?

*@returnrequires a reporting context*/

boolean requiresReports() default false;/**当mojo在多模块项目上运行时,该标注表示目标只会在顶层模块运行。* if the Mojo uses the Maven project and its child modules.

*@returnuses the Maven project and its child modules*/

boolean aggregator() default false;/**为true时,该目标就只能通过命令行直接调用。默认为false* can this Mojo be invoked directly only?

*@returninvoked directly only*/

boolean requiresDirectInvocation() default false;/**是否要求maven必须是在线状态,默认值为false* does this Mojo need to be online to be executed?

*@returnneed to be online*/

boolean requiresOnline() default false;boolean inheritByDefault() default true;/*** own configurator class.

*@returnown configurator class*/String configurator()default "";/*** is your mojo thread safe (since Maven 3.x)?

*@returnis thread safe*/

boolean threadSafe() default false;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值