我尝试在如下结构的多模块项目中执行Maven构建:
# Project dependencies generated by the Apache ServiceMix Maven Plugin
# Generated at: Mon Aug 28 18:42:30 IST 2017
groupId = com.stackoverflow
artifactId = sample
version = 1.1-SNAPSHOT
com.stackoverflow/sample/version = 1.1-SNAPSHOT
# dependencies
ch.qos.logback/logback-access/version = 1.2.3
ch.qos.logback/logback-access/type = jar
ch.qos.logback/logback-access/scope = compile
ch.qos.logback/logback-classic/version = 1.2.3
ch.qos.logback/logback-classic/type = jar
ch.qos.logback/logback-classic/scope = compile
... etc
鉴于我对高级Reactor选项的了解,我可以使用以下命令单独构建-> Project-Parent
-> Project-Utils
- pom.xml
-> Project-Service
- pom.xml
- pom.xml
项目:
Project-Utils
但是,似乎我必须在我的父POM中定义mvn -pl ./Project-Utils clean install
:
Project-Utils
有没有办法可以使用<modules>
<module>Project-Utils</module>
</modules>
选项而无需在父POM中定义模块?
答案 0 :(得分:-1)
在POM模块中,确保设置relativePath
<parent>
...
<relativePath/>
</parent>
这将确保maven将在您的存储库中搜索父pom。
要将父级安装到存储库中,请导航到父目录并执行
mvn clean install
然后导航到模块的目录并执行
mvn clean package
它应该选择已安装的父级