【问题标题】:How can I mix parent POMs in a Maven multi-module build?如何在 Maven 多模块构建中混合父 POM?
【发布时间】:2012-04-13 23:24:59
【问题描述】:

我有一个 Maven 多模块项目,并且在此构建中我需要两个不同的父 POM。第一个是项目中大多数模块的真正父 POM,但一个模块是演示项目,它使用完全不同项目的父 POM(因为它是如何使用我的项目为第二个项目生成代码的演示)。

构建工作,但我收到警告:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for my_project:my_project.demo:jar:5.0.0-SNAPSHOT
[WARNING] 'parent.relativePath' points at my_project:parent instead of other_project:parent, please verify your project structure @ line 5, column 10
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 

由于other_project 并不是我构建的真正模块,它可以在任何地方。这意味着我不能给出相对路径。

如何解决此警告?

【问题讨论】:

  • 它准确地说明了您所描述的内容,从 Maven 的角度来看是不正确的。如果您有一个演示项目,只需将其放入不同的位置,如 src/main/demonstration,可能会更改您的包装或更改您的项目站点。

标签: maven-2 relative-path multi-module parent-pom


【解决方案1】:

在这种情况下的解决方案是将relativePath 设置为空以覆盖默认的../pom.xml:

<relativePath/>

【讨论】:

    猜你喜欢
    • 2013-02-23
    • 1970-01-01
    • 1970-01-01
    • 2010-12-31
    • 2012-04-27
    • 1970-01-01
    • 1970-01-01
    • 2019-07-11
    • 2020-04-26
    相关资源
    最近更新 更多