parent.relativePath Warning is very misleading
----------------------------------------------

                 Key: MNG-5146
                 URL: https://jira.codehaus.org/browse/MNG-5146
             Project: Maven 2 & 3
          Issue Type: Bug
          Components: Errors
         Environment: Maven 3.0.3
            Reporter: Scott MacDonald
            Priority: Minor


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]
[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]
[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]

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.











--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to