gnodet opened a new pull request, #11427:
URL: https://github.com/apache/maven/pull/11427

   This PR addresses two issues with BOM (Bill of Materials) handling in 
consumer POMs reported in 
https://lists.apache.org/thread/41q40v598pd8mr32lmgwdfb2xm7lzm6l:
   
   ## Issues Fixed
   
   ### 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.
   
   ### 2. Dependency versions preserved in dependencyManagement
   When using `-Dmaven.consumer.pom.flatten=true` with a BOM, dependencies in 
dependencyManagement were missing their version tags.
   
   ## Solution
   
   The fix ensures that:
   - BOM packaging is always transformed to 'pom' in consumer POMs, regardless 
of whether flattening is enabled
   - Dependency 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
   
   ## Testing
   
   Manual testing confirms:
   - Consumer POMs for BOMs now have `packaging=pom` instead of `packaging=bom`
   - Dependency versions are preserved in dependencyManagement sections
   - Both with and without `-Dmaven.consumer.pom.flatten=true` work correctly
   
   ---
   Pull Request opened by [Augment Code](https://www.augmentcode.com/) with 
guidance from the PR author


-- 
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]

Reply via email to