是否可以通过命令行中的id调用maven-exec-plugin(或任何其他插件)执行?
假设我的pom.xml文件如下所示:
<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>
Run Code Online (Sandbox Code Playgroud)
现在可以打电话了
mvn exec:exec
有一些额外的魔法来运行执行"foo"?
好奇的是,有一个替代解决方案,使用此处提供的配置文件:http: //www.mail-archive.com/user@mojo.codehaus.org/msg00151.html
小智 24
现在可以从Maven 3.3.1开始:见改进MNG-5768和Maven 3.3.1发行说明
您可以使用以下语法调用特定的执行配置:
mvn exec:exec@foo
Run Code Online (Sandbox Code Playgroud)
Rya*_*art 11
这里没有提到的是,从Maven 2.2.0开始,如果你给任何插件执行id"default-cli",那么当你从命令行运行该插件时,就会使用该配置.你只限于每个插件的一个默认执行,但它是一个开始.