Hiteshsai007 commented on issue #11147:
URL: https://github.com/apache/maven/issues/11147#issuecomment-4876856128

   I have investigated the root cause of this issue and submitted a PR to fix 
it. 
   
   ### What was happening
   The issue lies in `DefaultModelBuilder.transformFileToRaw()`. During the 
transformation from the file model to the raw model, the builder checks for 
missing versions and group IDs (so it can infer them from the reactor). 
However, this inference logic was only being applied to the project's 
`<dependencies>`. It completely skipped `<dependencyManagement>`, meaning any 
sibling module dependencies managed in a BOM POM would be left without a 
version.
   
   ### The Fix
   I updated `transformFileToRaw` to also iterate through 
`model.getDependencyManagement().getDependencies()`, applying the same 
`inferDependencyVersion` and `inferDependencyGroupId` logic. 
   
   I tested this locally against the provided `bom-example` reproducer, and the 
installed consumer POM now correctly populates the versions 
(`<version>1.0.0-SNAPSHOT</version>`) as expected.
   
   Link to PR: #[Insert PR Number Here]
   


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