在maven 2中的命令行上设置插件的属性

在maven 2中的命令行上设置插件的属性

问题描述:

在maven 2.x中,如何在命令行上设置插件的属性,而不是在< configuration>

In maven 2.x, how would one set a plugin's property on the command line instead of in the <configuration> of that plugin in the pom or in settings.xml?

例如,如果我使用 mvn dependency:copy-dependencies 见这里)如何我可以设置useRepositoryLayout属性而不触及pom或我的settings.xml?

For example, if I was using mvn dependency:copy-dependencies(seen here) how can I set the useRepositoryLayout property without touching either the pom or my settings.xml?

谢谢!

答案是在我面前的副本依赖mojo docs(我甚至链接到它)。

Answer was right in front of me in the copy-dependencies mojo docs (I even linked to it). The documentation for the property includes the Expression you can refer to it by.


useRepositoryLayout:将每个
artifact放在同一个目录下layout
作为默认存储库。示例:
/outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar

useRepositoryLayout: Place each artifact in the same directory layout as a default repository. example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar

* Type: boolean
* Since: 2.0-alpha-2
* Required: No
* Expression: ${mdep.useRepositoryLayout}
* Default: false


要从命令行设置此属性,您需要运行

To set this property from command line you need to run

mvn -Dmdep.useRepositoryLayout=true <goals go here>