查找 Maven 插件绑定到的默认阶段
给定 pom.xml 中的
元素,如何找到它绑定到的默认阶段?
例如,我想知道 maven-war-plugin
执行在 Maven 生命周期的哪个阶段。
Given a <plugin>
element in a pom.xml
, how do I find the default phase that it binds to?
For example, I'd like to know which phase of the Maven lifecycle does the maven-war-plugin
gets executed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要了解项目中实际发生的情况,最好的方法是使用
mvn help: effective-pom
。它不仅显示默认值,而且还显示默认值。它显示了您当前的 pom 的实际内容。The best way to see what's really happening in your project along those lines is with
mvn help:effective-pom
. It doesn't just show the defaults; it shows what actually is according to your current pom.我对上面的回复有疑问。
这是一个简单的 pom。它使用注释处理器插件,默认情况下绑定到
generate-sources
,因为我没有指定
。mvngenerate-resources
确实调用了该插件...但是扫描
mvnhelp: effective-pom
的输出并没有产生任何关于该插件的默认绑定的线索。到目前为止,我发现列出默认阶段绑定的唯一方法是检查插件源。
I'm having a problem with the above-reply.
Here's a simple pom. It uses an annotation processor plugin, which is bound to
generate-sources
by-default, since I didn't specify a<phase>
.mvn generate-resources
does indeed invoke the plugin...Yet scanning the output of
mvn help:effective-pom
doesn't yield any clue to the default binding of this plugin.The only way I've so-far found to list default phase binding is by examining plugin source.