如何直接从命令行执行Maven插件执行? [英] How to execute maven plugin execution directly from command line?
问题描述
我有一个插件(antrun),其配置为具有ID且未绑定到任何阶段的执行.我可以直接从命令行执行此执行吗?
I have a plugin (antrun) with an execution configured which has an id and is not bound to any phase. Can I execute this execution directly from the command line?
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>my-execution</id>
...
</execution>
</executions>
</plugin>
运行类似以下内容的
mvn my-execution
或至少
mvn magicplugin:execute -DexecutionId=my-execution
推荐答案
此功能已 MNG-5768 ,并且在Maven 3.3.1中可用.
This functionality has been implemented as MNG-5768, and is available in Maven 3.3.1.
更改将:
扩展直接插件调用语法,以允许可选的@ execution-id参数,例如org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process @ executionId.
extend direct plugin invocation syntax to allow optional @execution-id parameter, e.g., org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId.
因此,在您的情况下:
mvn antrun:run
使用default-cli
执行ID,并且:
mvn antrun:run@my-execution
使用pom中配置的执行.
uses the execution configured in your pom.
这篇关于如何直接从命令行执行Maven插件执行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!