Maven complaining about parent relative path

删除回忆录丶 提交于 2019-12-03 10:08:59
blackbuild

In order to resolve the parent project, these possible sources are checked:

  • relativePath
  • local repository
  • remote repositories

The relative path, if not given explicitly, defaults to .., i.e. the pom in the parent directory of the current project. So Maven checks whether a) there is a pom file in that directory and b) that pom file contains the same coordinates as stated in the parent definition of the current project.

If a) and b) are true, that pom file is used as the parent for the resolving of the effective pom.

If a) is true, and b) is false, a warning is given, because this usually points to a misconfigured project (as in your case) and the pom is ignored.

If a) is false, the other sources are checked.

So, in your case, I assume you have the following in your utils/pom.xml

<parent>
  <groupId>...</groupId>
  <artifactId>ref-pom</artifactId>
  <version>..</version>
</parent>

which implicitly includes <relativePath>..</relativePath>. So Maven checks the parent directory of utils, finds a POM, but this point is named project-parent instead of the expected ref-pom. Thus the warning.

The following would work:

<parent>
  <groupId>...</groupId>
  <artifactId>ref-pom</artifactId>
  <version>..</version>
  <relativePath>../ref-pom</relativePath>
</parent>

(Note that in your text, you write about ref-pom, but in the modules above there is only client-ref-pom and server-ref-pom)

however

You should think about whether this is really what you want, in your case, if the separate *-ref-pom modules are really necessary or if the content of those poms could and should be better placed inside of the respective *-util modules.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!