Maven - 确定同一阶段不同插件目标的顺序
以下代码片段是 maven-cargo 插件配置的摘录,但问题与该特定插件无关。
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
<goal>start</goal>
</goals>
</execution>
</executions>
此配置(让我们简单地称之为插件 A)将等到 pre-integration-test
阶段,然后触发其目标 deploy
和 start
(在该订单)。
假设我有另一个插件 B,它在同一阶段相关。 有哪些选择
- 在 A 之前(之后)执行插件 B 的目标 ? (someStuff -> 部署 -> 开始)
- 在插件 A 的目标之间执行插件 B 的目标 (部署 -> someStuff -> 开始)
我认为 (1) 的答案是 此处,将目标的顺序链接到插件定义的顺序POM。但我不知道(2)。
The following snippet is an excerpt of the configuration of the maven-cargo plugin, but the question is independent from that specific plugin.
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
<goal>start</goal>
</goals>
</execution>
</executions>
This configuration (lets simply call it plugin A) will wait till pre-integration-test
phase, then fire its goals deploy
and start
(in that order).
Say I have another plugin B which is relevant in the same phase. What are my options to
- execute plugin B's goals before (after) A? (someStuff - > deploy -> start)
- execute plugin B's goals in-between plugin A's goals (deploy -> someStuff -> start)
I figure that the answer to (1) is here, linking the order of the goals to the order of the plugin definition in the POM. But I have no idea about (2).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你对(1)的看法是正确的。如果两个插件要在同一阶段执行,那么它们将按照 pom.xml 中声明的顺序执行。
我对(2)不是100%确定,但我认为如果没有一些技巧,这是不可能的,比如使用
exec-maven-plugin
,例如:You are right about (1). If two plugins are to be executed on the same phase, then they will be executed in the order they are declared in pom.xml.
I'm not 100% sure about the (2), but I think it's impossible without some hacks, like using
exec-maven-plugin
, for example: