How to invoke maven default lifecycle

If i call

mvn clean install

maven knows that `clean` is a lifecycle and `install` is a phase of the default lifecycle
if i call

mvn deploy

maven will execute all phases of the default lifecycle sequentially.
Is there a way to call the default lifecycle by giving a lifecyle name (instead of executing the last phsae of the lifecycle)?
EDIT: So the question is: is there a command

mvn lifecyclename
“`
that start execution of the default lifecycle?

There is no command to run a lifecycle based on lifecycle name. So you can’t do a mvn Default and expect it to run upto Default:deploy. You will have to mention a task of a cycle like test, package, clean and the life-cycle that owns this task will get active.
It does not make sense to have life-cycle as an argument. It will be confusing. For example running mvn clean is the Clean life-cycle or clean task?
Or, it will be more verbose to type mvn clean will run Clean life cycle; and mvn clean:clean will run Clean life cycle until clean task.
Maven has three life cycle. Executing a task (say task_N) of any of the life cycle will result in executing the whole life-cycle until that task (task_N). The three life cycles are Clean, Default, and Site.
For more details see here Introduction to Maven Life-cycles and task order
You see when you execute say, mvn test these are the things gets executed in that order
validate > initialize > generate-sources > process-sources > generate-resources > process-resources > compile > process-classes > post-process > generate-test-sources > process-test-sources > generate-test-resources > process-test-resources > test-compile > process-test-classes > test
You can’t skip any of the default tasks. You may hook plugins that gets gets executed during a task.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值