[
https://jira.codehaus.org/browse/MNG-5682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=355299#comment-355299
]
Devin Reid commented on MNG-5682:
---------------------------------
Ran in to this issue as well. This is documented behavior as indicated by
[Maven 3.x compatiblity
notes|https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Compatibility+Notes#Maven3.xCompatibilityNotes-ParentPOMResolution].
bq. Maven 3 no longer resolves parent POMs from the local project checkout
unless the child POM's <relativePath> element is accurate, whether explicitly
given or using the default value. This improves consistency regarding the build
result when building the child project in isolation and when performing a
reactor build that includes the parent project. In Maven 2, building the child
project in isolation could fail while the reactor build would succeed to
resolve the parent.
The reasoning behind this doesn't make sense to me. This change impacts
projects that want to "opt-out" of the of the relativePath functionality (i.e.
set <relativePath /> for parents in child poms) . If I set relativePath to be
no path I certainly want the pom to be resolved from the reactor. More over it
makes parent poms behavior as a dependency inconsistent with how every other
dependency in Maven works.
The reason stated that behavior was inconsistent between isolated and reactor
builds but I disagree. It was entirely consistent. Using the sample project
attached to this issue as an example, if B has a dependency on C, it will fail
to build in isolation if C hasn't been installed in exactly the same way it
will fail to build if 'parent' hadn't been installed. That is consistent and
the way Maven 2 worked. Now if parent isn't installed a reactor build fails,
even thought the same would not be true if C were not installed. Even worse, if
parent is installed and I make changes to it those changes are not picked up by
dependents even though parent is in the reactor. Very inconsistent behavior.
I would hope that this new behavior for parent resolution could be rolled back
in its entirety, but a less drastic change would be to allow resolving a parent
from the reactor when 'relativePath' is set to null/empty. At least that would
allow projects to 'opt-out' as before.
> Parent POMs not resolved in multi-module project
> ------------------------------------------------
>
> Key: MNG-5682
> URL: https://jira.codehaus.org/browse/MNG-5682
> Project: Maven
> Issue Type: Bug
> Components: Bootstrap & Build
> Affects Versions: 3.0.4, 3.1.1, 3.2.3
> Environment: Apache Maven 3.2.3
> (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00)
> Java version: 1.7.0_67, vendor: Oracle Corporation
> Default locale: en_US, platform encoding: Cp1250
> OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
> Reporter: Kek
> Priority: Minor
> Attachments: test-project.zip
>
>
> I have multi-module project - I attach the similar simple project structure
> to this issue, to simulate the problem => !test-project.zip!.
> The structure is:
> {noformat}
> A - aggregating project, parent for "parent"
> |_parent - parent for B and C
> |_B
> |_C
> {noformat}
> In reality we have more parents under A for diferent types of A-submodules,
> but now it does not matter.
> When we run build under maven 2.2.1 - everything is OK, the reactor sorts
> the projects like A, PARENT, B,C and build success.
> When we run the same build under maven 3.x (3.0.4, 3.1.1, 3.2.3 was tested),
> the build fails with following errors:
> a>mvn clean
> [INFO] Scanning for projects...
> [ERROR] The build could not read 2 projects -> [Help 1]
> [ERROR]
> [ERROR] The project a:b:[unknown-version] (\a\b\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact
> a:parent:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local
> POM @ line 6, column 10 -> [Help 2]
> [ERROR]
> [ERROR] The project a:c:[unknown-version] (\a\c\pom.xml) has 1 error
> [ERROR] Non-resolvable parent POM: Could not find artifact
> a:parent:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local
> POM @ line 6, column 10 -> [Help 2]
> [ERROR]
> [ERROR] To see the full stack trace of the errors, re-run Maven with the -e
> switch.
> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> [ERROR]
> [ERROR] For more information about the errors and possible solutions, please
> read the following articles:
> [ERROR] [Help 1]
> http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
> [ERROR] [Help 2]
> http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
> There is no explicit "relativePath" set in project POMs.
--
This message was sent by Atlassian JIRA
(v6.1.6#6162)