Skip to content

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Sep 17, 2025

Backport

This will backport the following commits from master to maven-4.0.x:

Fixes #11084

* ReactorReader: prefer consumer POM from project-local repo when resolving POMs

When only part of a reactor is built, ReactorReader mirrors artifacts into a project-local repo. If a module depends on another reactor module not in the current session, POM resolution may hit that repo. Today, the main POM path contains the build POM, which can include Maven-4 build-time constructs and be invalid as a repository POM (e.g., missing parent.*). As a result, dependency resolution can fail with fatal model errors.

Teach ReactorReader to prefer the consumer POM (classifier=consumer) for POM artifacts when present in the project-local repo, falling back to the main POM otherwise. This avoids consuming a build POM from the project-local repo without changing the repo contents or layout.

* Fix ReactorReader to prefer consumer POMs over build POMs

When building modules in isolation (outside of the full reactor), the
ReactorReader should prefer consumer POMs from the project-local repository
over build POMs to avoid invalid POM elements like <parent />.

The findModel method now:
1. First checks if the project is in the current reactor session
2. If not found, looks for a consumer POM in the project-local repository
3. Uses the same consumer POM preference logic as findInProjectLocalRepository

This eliminates 'invalid POM' warnings when building modules in isolation
while maintaining backward compatibility for reactor builds.

Fixes apachegh-11084

* Fix

(cherry picked from commit 93b85b0)
@gnodet gnodet added bug Something isn't working backport mvn40 labels Sep 17, 2025
@gnodet gnodet merged commit e668ec4 into apache:maven-4.0.x Sep 17, 2025
19 checks passed
@github-actions github-actions bot added this to the 4.0.0 milestone Sep 17, 2025
@gnodet gnodet deleted the backport/maven-4.0.x/pr-11107 branch September 17, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working mvn40

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant