将来自 Maven 的命令行参数作为 pom.xml 中的属性传递 [英] Passing command line arguments from Maven as properties in pom.xml
本文介绍了将来自 Maven 的命令行参数作为 pom.xml 中的属性传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将参数从命令行传递到 pom.xml
文件中的属性?例如我运行 mvn ... argument
Is it possible to pass arguments from command line to properties in pom.xml
file ?
for example I run mvn ... argument
在 pom.xml 中
and in pom.xml
<properties>
<myproperty> here should add argument from command line</myproperty>
</properties>
感谢您的帮助.
推荐答案
对于您的财产示例,请执行以下操作:
For your property example do:
mvn install "-Dmyproperty=my property from command line"
注意整个属性定义周围的引号.如果您的资产包含空格,您将需要它们.
Note quotes around whole property definition. You'll need them if your property contains spaces.
这篇关于将来自 Maven 的命令行参数作为 pom.xml 中的属性传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文