Maven complaining about parent relative path

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)