简体   繁体   English

在Maven Project的子模块中运行自定义pom.xml?

[英]Running custom pom.xml in child module of Maven Project?

I have a java maven project which has 1 parent pom and 3 child modules associated with it. 我有一个Java Maven项目,该项目具有1个父pom和3个与之关联的子模块。 One of the child module has a custom pom.xml alongwith the default pom.xml. 子模块之一具有自定义pom.xml以及默认pom.xml。 If I run mvn clean install on Parent pom, all the 3 child modules (with default pom.xml) gets executed. 如果我在父pom上运行mvn clean install,则将执行所有3个子模块(默认为pom.xml)。
I wanted to run custom pom.xml instead of default pom.xml for one of the child module. 我想为子模块之一运行自定义pom.xml而不是默认pom.xml。 I tried below: 我在下面尝试过:

mvn -pl module1,module2/custom.xml,module3 clean install

But it didn't work and I got below error: 但是它没有用,并且出现以下错误:
[ERROR] [ERROR] Could not find the selected project in the reactor:module2/custom.xml [错误] [错误]在反应堆中找不到所选项目:module2 / custom.xml

Instead of having custom pom for one module, you can use maven profile to achieve custom behavior in some build. 您可以使用Maven配置文件在某些​​构建中实现自定义行为,而不是为一个模块提供自定义pom。

You can run maven build with: 您可以使用以下命令运行Maven构建:

mvn -P profile_name clean install

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

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