maven

生命周期

生命周期组/职责

生命周期由不同的阶段组成,不同阶段的行为由与之关联的plug goals有关. 执行某个阶段总是先按顺序把之前的阶段给执行一遍.

mavne内置三种生命周期:

  1. default : 负责代码的编译部署
  2. clean : clean
  3. site : 生成site doc.

生命周期包含的阶段:

参考: Lifecycle Reference

plug

  • 通过声明插件goals 来绑定 不同的阶段. 也有不绑定任何阶段的插件goals,这种goal可以在声明周期之外独立调用.
  • goals 执行顺序取决于所绑定的阶段的执行顺序.
  • 如果goals被绑定到多个build phases,那么这个goal会被执行多次. 如果一个build phases没有绑定任何goal,那么这个build phases不会执行. 如果build phases绑定了多个goals那么执行这个build phases时候会执行所有的goals.

(Note: In Maven 2.0.5 and above, multiple goals bound to a phase are executed in the same order as they are declared in the POM, however multiple instances of the same plugin are not supported. Multiple instances of the same plugin are grouped to execute together and ordered in Maven 2.0.11 and above)

packaging 默认是jar (jar, war, ear and pom).每种packing contains a list of goals to bind to a particular phase. the jar packaging will bind the following goals to build phases of the default lifecycle. .... list https://maven.apache.org/ref/3.5.2/maven-core/default-bindings.html

另一种方法给phases添加goals是通过execution.phase 来绑定.执行goals.goal中的goal. Plugins有的也会有自己默认绑定的生命周期.

转载于:https://my.oschina.net/fuckmylife0/blog/1578095

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值