[英]How to execute maven plugin execution directly from command line?
我有一個配置了執行的插件 (antrun),它有一個 id 並且沒有綁定到任何階段。 我可以直接從命令行執行這個執行嗎?
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>my-execution</id>
...
</execution>
</executions>
</plugin>
用類似的東西運行它:
mvn my-execution
或者至少
mvn magicplugin:execute -DexecutionId=my-execution
您正在尋找的內容在Default+Plugin+Execution+IDs 中捕獲,但據我所知,目前不支持。 但是,根據MNG-3401的評論(閱讀到最后):
對於直接從命令行調用的 mojo,您可以使用 executionId: 'default-cli' 從 POM 提供配置,如下所示:
<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> <id>default-cli</id> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> <descriptorRef>project</descriptorRef> </descriptorRefs> </configuration> </execution> </executions> </plugin>
這應該適用於 Maven 2.2.0 和 3.x。
也許這對你來說就足夠了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.