Maven 2 Maven Maven exec插件多种执行配置
是否可以从命令行通过其id调用maven exec插件(或任何其他插件)的执行 假设我的pom.xml文件如下所示:Maven 2 Maven Maven exec插件多种执行配置,maven-2,maven,Maven 2,Maven,是否可以从命令行通过其id调用maven exec插件(或任何其他插件)的执行 假设我的pom.xml文件如下所示: <project> [...] <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <executions> <exe
<project>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>foo</id>
<goals>
<goal>exec</goal>
</goals>
<phase></phase>
<configuration>
<executable>echo</executable>
<arguments>
<argument>foo</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>bar</id>
<goals>
<goal>exec</goal>
</goals>
<phase></phase>
<configuration>
<executable>echo</executable>
<arguments>
<argument>bar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
[...]
</project>
[...]
org.codehaus.mojo
不,这是不可能的。执行是为了绑定到生命周期(即,它们不是为在命令行上调用而设计的)。因此,您必须使用您提供的链接中描述的配置文件技巧。我认为如果您编写并执行目标:
org.codehaus.mojo:exec-maven-plugin:¿Version?:exec
它在EclipseMaven插件中对我起作用。这里没有提到的是,在maven 2.2.0中,如果您从命令行运行该插件,则使用该配置。每个插件只能执行一次默认操作,但这只是一个开始。现在可以了,从Maven 3.3.1开始:请参阅改进和升级
您可以使用以下语法调用特定的执行配置:
mvn exec:exec@foo
这并不完全正确。看,这现在是可能的。请看slangois的回答。我无法在标签中使用插件。但是,将其放在标签外确实有效。错误是“goal org.codehaus.mojo:exec maven plugin:1.2.1:exec的参数'executable'丢失或无效”。请注意,在上面的“使用配置文件的替代解决方案”中,
标记丢失。