简体   繁体   English

在mvn命令中指定pom.xml并混合其他项目的目标

[英]specify pom.xml in mvn command and mix goals of other project

I have multiple questions. 我有多个问题。

  1. Can I specify the pom.xml in mvn command? 我可以在mvn命令中指定pom.xml吗?
  2. Can I mix the goals of another project while executing mvn command on current project ? 我可以在当前项目上执行mvn命令时混合另一个项目的目标吗?

    Eg: mvn clean-otherproject comple-otherproject instal-otherproject compile-thisproject 例如: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命令中执行此操作。

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

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 (eg mvn install -pl util -am only builds the module 'util' and it's dependencies) 在多模块项目中,如果从顶层项目调用mvn install ,则将构建所有子模块,除非您使用高级反应堆选项 (例如mvn install -pl util -am仅构建模块“ util”及其依赖项)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM