gnodet opened a new pull request, #12422: URL: https://github.com/apache/maven/pull/12422
## Summary Follow-up to #12406 — fixes the same GAPV vs GAV inconsistency in a different code path. In `DefaultModelBuilder.readAsParentModel()`, the **cache-hit** path (line 1944) used `Model.getId()` which returns `groupId:artifactId:packaging:version` (GAPV), while the **cache-miss** path (line 1961) correctly used `ModelProblemUtils.toId()` which returns `groupId:artifactId:version` (GAV). This inconsistency could cause the same parent's profiles to be stored under different keys depending on whether the parent model was resolved from cache or freshly built. The fix is a one-liner: replace `cached.model().getId()` with `ModelProblemUtils.toId(cached.model())` to match the cache-miss path. - **Cache miss** (line 1961): `ModelProblemUtils.toId(model)` → `g:a:v` ✅ - **Cache hit** (line 1944): `cached.model().getId()` → `g:a:p:v` ❌ → **fixed** to `ModelProblemUtils.toId(cached.model())` Also adds a test that verifies parent profile source keys use consistent GAV format across child modules in a multi-module build. Note: the cache-hit path requires a matching `ProfileActivationContext.Record` which is hard to trigger in a unit test (sibling modules record different model info), but the fix is correct by inspection — it matches the existing pattern on the cache-miss path. ## Test plan - [x] Existing `testActivatedProfileBySource` passes - [x] New `testParentProfileSourceKeyConsistentAcrossModules` passes - [x] Full `DefaultMavenProjectBuilderTest` suite passes (34 tests) - [x] Full `DefaultProjectBuilderTest` suite passes (3 tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
