【发布时间】:2011-01-12 15:42:54
【问题描述】:
是否可以从命令行通过其 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:exec
添加一些魔法来运行执行“foo”?
对于好奇的人,这里有一个使用配置文件的替代解决方案: http://www.mail-archive.com/user@mojo.codehaus.org/msg00151.html
【问题讨论】:
-
我无法让插件与
标记中的 一起工作。但是,它确实可以将其放在 标记之外。错误是“目标 org.codehaus.mojo:exec-maven-plugin:1.2.1:exec 的参数 'executable' 丢失或无效” -
请注意,在上述“使用配置文件的替代解决方案”中,缺少
<plugins>标签。