Skip to content

[maven-4.0.x] Fix profile source tracking in multi-module projects (fixes #11409) (#11440) - #11466

Merged
gnodet merged 2 commits into
apache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/pr-11440
Nov 18, 2025
Merged

gnodet merged 2 commits into
apache:maven-4.0.xfrom
gnodet:backport/maven-4.0.x/pr-11440

Conversation

@gnodet

@gnodet gnodet commented Nov 18, 2025

Copy link
Copy Markdown
Contributor

Backport

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

Questions ?

Please refer to the Backport tool documentation

) (apache#11440)

The root cause was that ModelBuilderResult.getActivePomProfiles()
returned all active profiles as a flat list without tracking which
model each profile came from.

This commit:
- Adds getActivePomProfiles(String modelId) and
  getActivePomProfilesByModel() methods to ModelBuilderResult API
  to track profiles per model like Maven 3 did
- Updates DefaultModelBuilder to track model IDs when adding profiles,
  using ModelProblemUtils.toId() to get groupId:artifactId:version
  format (without packaging) to match Maven 3 behavior
- Updates DefaultProjectBuilder to use the new per-model profile
  tracking API to correctly set injected profile IDs
- Adds integration test MavenITgh11409ProfileSourceTest to verify
  the fix and prevent regression

Profile sources now correctly show groupId:artifactId:version format,
matching Maven 3 behavior.

Fixes apache#11409

(cherry picked from commit 405e2e1)

# Conflicts:
#	impl/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
@gnodet
gnodet force-pushed the backport/maven-4.0.x/pr-11440 branch from 12a4262 to 6a4cd98 Compare November 18, 2025 19:48
@gnodet gnodet added bug Something isn't working backport mvn40 labels Nov 18, 2025
@gnodet
gnodet merged commit 21a215c into apache:maven-4.0.x Nov 18, 2025
22 checks passed
@github-actions github-actions Bot added this to the 4.0.0 milestone Nov 18, 2025
@gnodet gnodet modified the milestones: 4.0.0, 4.0.0-rc-6 Jul 24, 2026
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