Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'parent.relativePath' points at my com.mycompany:MyProject instead of org.apache:apache - Why?

Tags:

maven

What is true is that Solr project directory is inside MyProject parent directory (but there's no module or any maven relationship between the 2, just FS convenience). Do I have to place it out?

$ mvn -DskipTests clean install
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.apache.lucene:lucene-solr-grandparent:pom:3.1-SNAPSHOT
[WARNING] 'parent.relativePath' points at com.mycompany:MyProject instead of org.apache:apache, please verify your project structure @ line 23, column 11
[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] 

from pom.xml:

<parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>8</version>
  </parent>

$ pwd
/Users/simpatico/ws/MyProjectBaseDir/solr
like image 767
simpatico Avatar asked Sep 29 '22 06:09

simpatico


People also ask

What is parent relativePath in Maven?

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.

What is the use of relative path in Pom?

relativePath allows you to select a different location, for example when your structure is flat, or deeper without an intermediate parent POM. However, the group ID, artifact ID and version are still required, and must match the file in the location given or it will revert to the repository for the POM.


1 Answers

Add an empty <relativePath> to <parent> so that it resolves the parent pom from the repositories.

  <parent>
    <groupId>org.apache</groupId>
    <artifactId>apache</artifactId>
    <version>8</version>
    <relativePath></relativePath>
  </parent>

Here is the relevant doc.

This feature is only for enhancing the development in a local checkout of that project. Set the value to an empty string in case you want to disable the feature and always resolve the parent POM from the repositories.
Default value is: ../pom.xml.

like image 302
Raghuram Avatar answered Oct 08 '22 20:10

Raghuram