以下代码段是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,它与在同一阶段相关。我有什么选择
我认为(1)的答案是here,将目标的顺序与POM中插件定义的顺序联系起来。但我不知道(2)。
答案 0 :(得分:11)
你是对的(1)。如果要在同一阶段执行两个插件,那么它们将按照在pom.xml中声明的顺序执行。
我不是100%肯定(2),但我认为没有一些黑客是不可能的,比如使用exec-maven-plugin
,例如:
<!-- deploy -->
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- do something -->
<plugin>
<groupId>some_other_plugin</groupId>
<artifactId>some_other_plugin</artifactId>
<executions>
<execution>
<id>someStuff</id>
<phase>pre-integration-test</phase>
<goals>
<goal>some_goal</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- start -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>mvn</executable>
<commandlineArgs>org.codehaus.cargo:cargo-maven2-plugin:start -Dparam=value</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>