Skip to content

FindManagedDependency: resolve version for BOM imports#7162

Merged
MBoegers merged 1 commit intomainfrom
MBoegers/find-mgd-dep-parent-ver
Mar 26, 2026
Merged

FindManagedDependency: resolve version for BOM imports#7162
MBoegers merged 1 commit intomainfrom
MBoegers/find-mgd-dep-parent-ver

Conversation

@MBoegers
Copy link
Copy Markdown
Contributor

@MBoegers MBoegers commented Mar 26, 2026

Summary

  • FindManagedDependency failed to match BOM imports (<type>pom</type><scope>import</scope>) when a version selector was specified, because findManagedDependency() returns null for BOM entries (only their transitive managed dependencies are stored as ResolvedManagedDependency)

  • Added fallback in versionIsValid() to resolve the version directly from the tag's <version> child via ResolvedPom.getValue() when findManagedDependency() returns null

  • This handles ${project.parent.version} and other property expressions in BOM import versions

  • Fixes moderneinc/customer-requests#2076

Test plan

  • versionFromProjectParentVersion — regular managed dep with ${project.parent.version}, version selector matches
  • bomImportVersionFromProjectParentVersion — BOM import with ${project.parent.version}, version selector matches
  • All existing FindManagedDependencyTest tests continue to pass

…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
Copy link
Copy Markdown
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Good to have this fixed quickly.

@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Mar 26, 2026
@MBoegers MBoegers merged commit bfc5fa3 into main Mar 26, 2026
1 check passed
@MBoegers MBoegers deleted the MBoegers/find-mgd-dep-parent-ver branch March 26, 2026 15:06
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants