You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Emmanuel Bourg (Jira)" <ji...@apache.org> on 2023/02/22 09:23:00 UTC

[jira] [Commented] (MNG-5146) parent.relativePath Warning is very misleading

    [ https://issues.apache.org/jira/browse/MNG-5146?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17692046#comment-17692046 ] 

Emmanuel Bourg commented on MNG-5146:
-------------------------------------

This issue is worth reopening, for some reason this prevents IntelliJ from synchronizing the project. The message is misleading and it took me quite some time to troubleshoot this issue. A better warning message would have help a lot.

> parent.relativePath Warning is very misleading
> ----------------------------------------------
>
>                 Key: MNG-5146
>                 URL: https://issues.apache.org/jira/browse/MNG-5146
>             Project: Maven
>          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 was sent by Atlassian Jira
(v8.20.10#820010)