Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-5146

parent.relativePath Warning is very misleading



    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Auto Closed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Errors
    • Labels:
    • Environment:
      Maven 3.0.3


      When a parent pom.xml is located in a sibling directory as the children, and <relativePath> is not set in the <parent> element of the children, maven spits out a completely bogus, very misleading, warning message.

      For example, suppose com.fubar and com.parent are in sibling directories (along with a bunch of other modules), and com.fubar specifies com.parent as its parent, but does snot specify a parent.relativePath in it parent element.

      When you run a build, you get the following...

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

      The warning incorrectly states that the child pom has specified com.someRandomModule (a completely unrelated module) as its parent when that is completely not the case. The unlreated module, in this case, happens to be an existing module in a differrnt sibling directory, but otherwise has no relation whatsoever to the parent or child.

      It would be much better to warn about the actual problem....

      The actual problem is that maven first tries to resolve parent poms locally based on the value of relativePath in the parent element of the child. IF it does not find it there, it will then resolve the parent from the repos. The current default value of relativepath is ../pom.xml (which in my case doesn;t work because my parent is in a sibling directory)

      The warning should be changed to something useful, such as....

      [WARNING] Could not resolve parent pom locally using parent.relativePath value of ../pom.xml. Parent pom will be resolved from local or remote repository. To disable local parent pom resolution, specify <relativePath><relativePath> in you <parent> element.


          Issue Links



              • Assignee:
                scanguskhan Scott MacDonald
              • Votes:
                3 Vote for this issue
                4 Start watching this issue


                • Created: