Java 在 mvn 命令中指定 pom.xml 并混合其他项目的目标
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4023597/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
specify pom.xml in mvn command and mix goals of other project
提问by srinannapa
I have multiple questions.
我有多个问题。
- Can I specify the pom.xml in mvn command?
Can I mix the goals of another project while executing mvn command on current project ?
Eg: mvn clean-otherproject comple-otherproject instal-otherproject compile-thisproject
- 我可以在 mvn 命令中指定 pom.xml 吗?
在当前项目上执行 mvn 命令时,我可以混合另一个项目的目标吗?
例如: mvn clean-otherproject comple-otherproject instal-otherproject compile-thisproject
I can do this with multiple mvn commands, but Can I do this in single maven command.
我可以用多个 mvn 命令来做到这一点,但我可以用单个 maven 命令来做到这一点。
采纳答案by khmarbaise
Just mvn --help
would have answered the first question:
刚刚mvn --help
会回答第一个问题:
mvn -f otherPomFile.xml
No. You can simple execute the phases for the current project you are in. You can give multiple phases like
不。您可以简单地执行当前项目的阶段。您可以提供多个阶段,例如
mvn clean install site site:deploy
回答by Sean Patrick Floyd
For the first question, see khmarbaise's answer
第一个问题见khmarbaise的回答
If you want to build more than one maven project in one step, you must use modules.
如果你想一步构建多个maven项目,你必须使用modules。
In a multi-module project, if you call mvn install
from the top project, all sub modules are built, unless you use the advanced reactor options(e.g. mvn install -pl util -am
only builds the module 'util' and it's dependencies)
在多模块项目中,如果您mvn install
从顶层项目调用,则会构建所有子模块,除非您使用高级反应器选项(例如,mvn install -pl util -am
仅构建模块 'util' 及其依赖项)