Repository navigation
Report parent POM profiles as inactive - #441
Conversation
a814610 to
d4c274d
Compare
This comment has been minimized.
This comment has been minimized.
slachiewicz
left a comment
There was a problem hiding this comment.
A profile activated in the parent POM is active for the child module: Maven injects it during the child's model build and records it in MavenProject.getInjectedProfileIds(), which is also what help:active-profiles reports. The original all-profiles-parent-pom expectation (active in both runs) is correct, so this change, and the new unit test, make all-profiles disagree with active-profiles. Could you instead mark a parent's profile as active when getInjectedProfileIds() lists it under the parent's model id, and keep the existing IT?
Keep all-profiles consistent with active-profiles for parent and grandparent profiles, including CI-friendly versions. Restore the original parent-profile integration test. Generated-by: OpenAI
slawekjaranowski
left a comment
There was a problem hiding this comment.
Thanks for the update — using MavenProject.getInjectedProfileIds() looks like the right approach, and CI is green on both Maven 3.10 and 4.0.0-rc-7.
Title / description are out of date — they still describe the earlier approach ("report parent POM profiles as inactive"). Could you update them? Suggested title:
Mark parent POM profiles as active only when injected into the current project
and description along the lines of:
help:all-profilesreported profiles declared in parent POMs as active based on the parent project's own build context. Now a parent profile is reported as active only if it was actually injected into the current project's model (MavenProject.getInjectedProfileIds()).Fixes #387
Simplification — I left inline suggestions that replace the model-ID reconstruction with a plain set of all injected profile IDs (rationale in the comment on the loop). They can be applied together via "Add suggestion to batch"; with all of them applied, mvn verify -Prun-its passes locally on Maven 3.10 and 4.0.0-rc-7.
(Optional) An IT reproducing the exact #387 scenario (a parent profile activated in the parent's context but not in the child's) would verify the behaviour against real model building, not only mocks.
Collect injected POM profile IDs without reconstructing model coordinates. Exclude the documented external-profile entry so inactive ancestor profiles do not overwrite an active settings profile's source. Retain POM activity when the same ID is genuinely injected from both sources. Add settings-only and dual-active collision unit tests and a real parent-POM integration regression. Validated with Maven 3.10.0 (35 unit, 37 integration) and Maven 4.0.0-rc-7 (35 unit, 34 integration, 3 version skips) on JDK 17. Generated-by: OpenAI
Summary
Fixes #387. Use Maven's injected profile IDs when reporting profiles in
help:all-profiles, so parent-POM profiles activated for the current project are shown as active. This follows the same profile information used byhelp:active-profiles; settings profiles are not incorrectly presented as POM profiles.Testing
The integration tests cover injected parent profiles, inactive parent and child profiles, and a settings profile. The maintainer reports CI passing on Maven 3.10 and 4.0.0-rc-7. The previous local test count is omitted because it predates the current implementation.