【发布时间】:2015-08-02 10:36:51
【问题描述】:
我想使用父 maven 项目/聚合器来构建我的项目和我在源根目录中作为 git 子模块的依赖项,例如
aggregator pom.xml
- dependency pom.xml
- project pom.xml
我天真地从 GNU C/C++ 项目中改编了这个布局,例如 coreutils,它只是将依赖项作为子模块检出,并将它们与项目状态/提交一起更新为兼容的提交。
maven 的问题是在 pom.xml 的依赖项中有一个 parent 指令,删除它肯定需要修改依赖项,这不是此设置的意图。所以,同样的问题以非常不同的方式提出:pom 中的 parent 指令是否肯定会阻止项目被用作 maven 模块?。警告Some problems were encountered while building the effective model or [dependency] 'parent.relativePath' of POM [dependency] points at [aggreator] instead of org.sonatype.oss:oss-parent, please verify your project structure可以忽略吗?
我知道这不是 maven 的预期工作流程(考虑到本地缓存),并且可以通过使依赖项不是 maven 模块,而只是一个 git 子模块来轻松实现并在源根目录和依赖子目录中编写一个调用mvn 的两行构建脚本。
我尝试使用reactor 插件,但它根本不构建任何未包含在module 声明中的东西(make 和make-dependents 目标)(错误Couldn't find project [dependency] in reactor; make sure you specified the correct group:artifactId)。
我使用的是 maven 3.3.1。
【问题讨论】: