Skip to content

Conversation

@steve-aom-elliott
Copy link
Contributor

@steve-aom-elliott steve-aom-elliott commented Oct 3, 2025

What's changed?

  • Previously, when you had a POM with a managed dependency that did not have an explicit version tag (because the version was applied to the managed dependency in an external parent artifact), calling ChangeManagedDependencyGroupIdAndArtifactId would fail to make the full needed change. Now it will add the version tag to the managed dependency.
  • Logic has also been adjusted within ChangeDependencyGroupIdAndArtifactId to prevent also adding the version tag to the direct dependency that is managed in the scenario that we end up changing the managed dependency as well.
  • Guard added against considering all resolved managed dependencies as being managed for the purposes of an existing managed dependency in favour of considering only requested, defined, managed dependencies upwards through the parents.

What's your motivation?

This was preventing managed dependencies from being updated correctly.

Anything else to consider?

If we have a local parent POM that has a requested managed dependency on A, and the child POM has a requested managed import dependency that would expand to include a managed dependency on A once resolved, should we not be able to affect change on the managed dependency because the closest one could be the one managed by the BOM imported managed dependency in the child POM?

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@steve-aom-elliott steve-aom-elliott self-assigned this Oct 3, 2025
@steve-aom-elliott steve-aom-elliott added the bug Something isn't working label Oct 3, 2025
@steve-aom-elliott steve-aom-elliott added the test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail label Oct 3, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Oct 3, 2025
@steve-aom-elliott steve-aom-elliott force-pushed the 1465-change-managed-dependency-can-add-version-tag-if-needed branch 2 times, most recently from 9145b75 to dd9965c Compare January 16, 2026 17:20
@steve-aom-elliott steve-aom-elliott moved this from In Progress to Ready to Review in OpenRewrite Jan 16, 2026
@steve-aom-elliott steve-aom-elliott marked this pull request as ready for review January 16, 2026 18:58
…ave an explicit `version` tag would fail to add a `version` tag when providing the `newVersion` option.
…y. Delegating `maybeUpdateModel()` call to implied `ChangeManagedDependencyGroupIdAndArtifactId` in applicable cases to avoid interim dependency resolution failure.
…local parent POMs and only consider those managed dependencies that are actually defined in the requested set of managed dependencies, rather than those that get resolved via an import managed dependency. Tidied up some method names and renamed a test to better represent what it's actually doing.
…d a more complicated example for `ChangeDependencyGroupIdAndArtifactId`
@steve-aom-elliott steve-aom-elliott force-pushed the 1465-change-managed-dependency-can-add-version-tag-if-needed branch from dd9965c to 47ff7cd Compare January 16, 2026 21:43
@sambsnyd sambsnyd merged commit d890c71 into main Jan 16, 2026
2 checks passed
@sambsnyd sambsnyd deleted the 1465-change-managed-dependency-can-add-version-tag-if-needed branch January 16, 2026 23:51
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working maven test provided Already replicated with a unit test, using JUnit pioneer's ExpectedToFail

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants