是否可以通过命令行的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>现在可以打电话了吗
mvn主管:exec
增加了一些魔法来执行"foo"?
对于好奇的人来说,这里有一个使用概要文件的替代解决方案:http://www.mail-archive.com/user@mojo.codehaus.org/msg00151.html
发布于 2010-02-03 17:53:04
不,这不可能。执行是为了绑定到生命周期(也就是说,它们不是为在命令行上调用而设计的)。因此,您必须使用您提供的链接中描述的配置文件技巧。
发布于 2015-07-10 10:21:21
发布于 2011-08-16 22:43:32
这里没有提到的是,从Maven 2.2.0开始,如果您使用执行任何插件的id“默认-cli”。,那么当您从命令行运行插件时,就会使用该配置。您仅限于每个插件的默认执行一次,但这是一个开始。
https://stackoverflow.com/questions/2192660
复制相似问题