dodoshell opened a new pull request, #13988: URL: https://github.com/apache/maven/pull/13988
The dependency management of an imported BOM is cached under groupId:artifactId:version and the `import` tag, whatever the location tracking of the build that imported it. The model cache lives for the whole session, so when the BOM is first imported by a model built without location tracking (e.g. the POM of a build extension, read through the artifact descriptor reader), a later project build with location tracking reuses that copy and the managed dependencies it contributes have no `InputLocation`. This caches the dependency management of builds with location tracking under a separate tag, `import-with-locations`, so they never pick up a copy without locations. Builds without location tracking keep using the existing `import` tag. Added a test in `DefaultModelBuilderTest` that builds a POM importing a BOM twice with the same `ModelCache`, first without and then with location tracking, and checks that the managed dependency version has a location. It fails without the change. The raw parent cache (`ModelCacheTag.RAW` in `readParent`) is keyed the same way, so a parent resolved from a repository and first read without location tracking can still end up without locations. I left it out to keep this change focused on the reported case; happy to follow up if wanted. The same code is on maven-3.9.x, so this could be backported there if you think it is worth it. `master` doesn't seem affected, since the XML parser there always records locations. Fixes #13985 --- To make clear that you license your contribution under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) check one of the following: - [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0) - [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). -- 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]
