FindManagedDependency: resolve version for BOM imports#7162
Merged
Conversation
…t.parent.version} For BOM import entries (<type>pom</type><scope>import</scope>), findManagedDependency() returns null because the BOM itself is not stored as a ResolvedManagedDependency. This caused versionIsValid() to always return false when a version selector was specified. Fall back to resolving the version directly from the tag's <version> child via ResolvedPom.getValue() when findManagedDependency() returns null. Fixes moderneinc/customer-requests#2076
timtebeek
approved these changes
Mar 26, 2026
Member
timtebeek
left a comment
There was a problem hiding this comment.
Nice! Good to have this fixed quickly.
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.
Summary
FindManagedDependencyfailed to match BOM imports (<type>pom</type><scope>import</scope>) when a version selector was specified, becausefindManagedDependency()returnsnullfor BOM entries (only their transitive managed dependencies are stored asResolvedManagedDependency)Added fallback in
versionIsValid()to resolve the version directly from the tag's<version>child viaResolvedPom.getValue()whenfindManagedDependency()returnsnullThis handles
${project.parent.version}and other property expressions in BOM import versionsFixes moderneinc/customer-requests#2076
Test plan
versionFromProjectParentVersion— regular managed dep with${project.parent.version}, version selector matchesbomImportVersionFromProjectParentVersion— BOM import with${project.parent.version}, version selector matchesFindManagedDependencyTesttests continue to pass