Skip to content

Resolve Maven property references when matching dependency tags#7351

Merged
timtebeek merged 1 commit intomainfrom
tim/fix-yaml-merge-key
Apr 13, 2026
Merged

Resolve Maven property references when matching dependency tags#7351
timtebeek merged 1 commit intomainfrom
tim/fix-yaml-merge-key

Conversation

@timtebeek
Copy link
Copy Markdown
Member

@timtebeek timtebeek commented Apr 11, 2026

Summary

Test plan

  • Added test removeDependencyDefinedWithProperties that uses ${junit.groupId} property in a dependency's groupId
  • All existing RemoveDependencyTest tests pass
  • Full rewrite-maven test suite passes

Fixes #4796 — `RemoveDependency` (and other recipes using `isDependencyTag`
or `findDependency`) failed to match dependencies whose groupId or
artifactId was defined via a Maven property (e.g. `${junit.groupId}`).

The root cause was that `isDependencyTag` and `findDependency` in
`MavenVisitor` compared raw XML tag values against resolved dependency
coordinates without first resolving property placeholders. Now both
methods use `ResolvedPom.getValue()` to expand properties before
comparing.
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite Apr 13, 2026
@timtebeek timtebeek merged commit 22ac624 into main Apr 13, 2026
1 of 2 checks passed
@timtebeek timtebeek deleted the tim/fix-yaml-merge-key branch April 13, 2026 22:01
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

RemoveDependency doesn't remove the dependency if one of its part is defined with properties

2 participants