什么是从命令行运行maven插件的语法。
问题描述:
我看到这已经在这里问过了:How to execute maven plugin from command line? 但我真的不明白答案。它看起来像语法的形式:什么是从命令行运行maven插件的语法。
mvn foo:bar
但我不知道什么foo和酒吧应该是。
具体来说,我已经配置了Maven的资源插件是这样的:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<!--configuration here-->
</configuration>
</execution>
</executions>
</plugin>
我试过的mvn artifactId|id|phase|goal:artifactidId|id|phase|goal
数排列,但他们都不工作。我想我会停止尝试蛮力,只是问互联网。此外,这是否记录在任何地方?
答
有3种模式:
groupId:artifactId:version:goal
groupId:artifactId:goal
prefix:goal
如果你从一个pom.xml一个位置运行这一点,你有没有指定的版本,Maven会搜索在构建截面匹配的插件。 前缀通常可能(并非总是)被识别为artifactId的一部分,例如maven-help-plugin
的前缀为help
。插件文档应该给你确切的前缀。
答
如下你会调用该插件目标:
mvn resources:copy-resources
其中copy-resources
是你在POM中配置的插件目标,并resources
是maven-resources-plugin
的前缀(见this link对于插件前缀分辨率) 。