[maven-4.0.x] Fix BOM packaging in consumer POMs (#11427)#11464
Merged
gnodet merged 2 commits intoapache:maven-4.0.xfrom Nov 18, 2025
Merged
[maven-4.0.x] Fix BOM packaging in consumer POMs (#11427)#11464gnodet merged 2 commits intoapache:maven-4.0.xfrom
gnodet merged 2 commits intoapache:maven-4.0.xfrom
Conversation
This commit addresses two issues with BOM (Bill of Materials) handling in consumer POMs: 1. BOM packaging not transformed to POM in consumer POMs: When a project uses packaging=bom, the consumer POM was incorrectly retaining this packaging type. Since 'bom' is not a valid packaging type in Maven 4.0.0 model, this caused errors when the consumer POM was used. The fix ensures that BOM packaging is always transformed to 'pom' in consumer POMs, regardless of whether flattening is enabled. 2. Dependency versions preserved in dependencyManagement: The effective model already contains resolved versions for dependencies in dependencyManagement sections. The fix ensures these versions are properly preserved in the consumer POM for both flattened and non-flattened BOMs. Changes: - Modified DefaultConsumerPomBuilder.build() to detect BOMs based on original packaging and handle them appropriately - Added buildBomWithoutFlatten() method to handle BOMs when flattening is disabled, using the raw model but still transforming packaging - Added integration test to verify both issues are fixed Fixes issues reported in: https://lists.apache.org/thread/41q40v598pd8mr32lmgwdfb2xm7lzm6l (cherry picked from commit 7d6fd87)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mastertomaven-4.0.x:Questions ?
Please refer to the Backport tool documentation