Conversation
…nagement BOM packaging was using getEffectiveModel() which includes all dependency management entries inherited from the parent chain. This caused parent-declared entries (and flattened BOM imports) to leak into the consumer BOM. Use a hybrid approach: the raw model (no inheritance) determines WHICH entries belong in the BOM, while the effective model provides resolved values. Import- scoped entries are preserved as BOM references with versions interpolated from the project properties, rather than being flattened. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
left a comment
There was a problem hiding this comment.
Looks good. The hybrid raw-model + effective-model approach is the right architecture — using the raw model for declared entry identity and the effective model for resolved values correctly avoids both the inheritance leak and the property-resolution regression from #12625.
CI is fully green across all platforms and JDK versions.
Two suggestions for follow-up (non-blocking):
-
interpolateVersionrobustness — the hand-rolled property interpolator at line 262 handlesproject.getProperties(),${project.version}, and${project.groupId}, but misses${project.artifactId}, system/environment properties, and nested references. The siblingPomInlinerTransformerin the same package uses the injectedInterpolatorservice which handles all these cases. Consider using it for robustness. -
Test coverage for import-scoped BOM entries — the test uses plain dependency management entries, but the original report (#12640) specifically involves import-scoped BOM entries in the parent (junit-bom, assertj-bom) whose flattened contents leak into the consumer BOM. Adding a test variant with import-scoped entries would cover the exact reported scenario.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
Summary
Example
Input
Parent POM — declares
ext-lib-aandext-lib-bin dependency management:BOM module — declares only
mod-1andmod-2:Previous output (broken — after
4032fc8)The consumer POM included all 4 entries — the 2 declared + 2 inherited from parent:
Current output (fixed — this PR)
The consumer POM contains only the 2 entries declared in the BOM, with versions resolved:
Context
The previous fix (
4032fc8) switched fromgetRawModel()togetEffectiveModel()to solve dangling${...}property references in the consumer BOM. That fixed property resolution but causedgetEffectiveModel()to include ALL inherited dependency management entries from the parent POM chain — exactly the issue Karl reported.The new
filterToOwnDependencyManagement()method intersects both models:project.getProperties()Test plan
MavenITgh12640BomInheritedDepMgmtTest— verifies inherited entries don't leak (new)MavenITBomConsumerPomPropertyResolutionTest— property resolution still works (existing, 3 tests)MavenITgh11427BomConsumerPomTest— BOM packaging transform still works (existing)MavenITmng8293BomImportFromReactor— reactor BOM import still works (existing)MavenITConsumerPomBomFromSettingsRepoTest— settings repo BOM still works (existing)All 16 tests pass locally.
🤖 Generated with Claude Code