问题描述
在调用Maven构建以指定备用文件代替标准pom.xml文件名时是否存在参数?
Is there an argument when calling a maven build to specify an alternate file in place of the standard pom.xml file name?
基本上,我需要使用各种配置来运行我的Maven构建的 test 目标.现在,我必须使用外部脚本来使用此配置更新标准pom,然后再还原文件.我更希望能够维护几个单独的配置文件,并使用我需要的特定文件来调用maven.
Basically, I have a need to run the test goal of my maven build with a variety of configurations. Right now I am having to use an external script to update the standard pom with this configurations, then revert the file after. I would much rather just be able to maintain several seperate configuration files and call maven with the specific one I need.
我想知道的是,是否有某种方法可以覆盖pom.xml,例如
What I am wondering is if there is some way to override the pom.xml such as
mvn clean test (uses standard pom.xml)
mvn clean test -Dmaven.source=alternate.xml
mvn clean test -Dmaven.source=alternate2.xml
这可能吗?
推荐答案
使用-f选项:
mvn -f <other pom file>
这篇关于Maven备用Pom的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!