No plugin goals bound to a maven phase

六月ゝ 毕业季﹏ 提交于 2021-02-09 09:20:42

问题


Quite new in maven. By reading document of maven at official website, I know in the default lifeCycle, there are 21 phases including validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install and deploy.

But when I see Built-in Lifecycle Bindings, I found that there is no plugin goals binding to phases like validate, initialize, verify, etc.
So if I run command mvn package, are phases without plugin goals going to be executed?
Or plugins goals for these phases are fixed and we do not have control of them so there is no need to write them in the document. Every time these phases like validate, initialize, verify, etc. will be executed automatically.


回答1:


First yes there are no plugins bound to the phases validate, initialize and verify by default (and some other phases as well).

If you run mvn package all phases will be executed but if there is no plugin bound to a phase you can't see it. If you run package phase all the phases including package phase itself will be executed from the beginning validate, initialize, generate-sourcesand so on...

Sometimes it is useful to bind plugins to phases like initialize. This is the case for example for the build-number-maven-plugin.

Phases before verify like pre-integration-test, integration-test and post-integration-test are useful to run integration tests which can be handled by maven-failsafe-plugin. The unit tests are handled by the maven-surefire-plugin.

Phases like generate-sources are often used by source generating plugins like jaxb2-maven-plugin or others like annotation processor generation plugins...



来源:https://stackoverflow.com/questions/39940552/no-plugin-goals-bound-to-a-maven-phase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!