[Gradle] Support updating dependencies in the `dependencyManagement` block
What problem are you trying to solve?
When running the org.openrewrite.java.dependencies.UpgradeDependencyVersion recipe, BOM dependencies defined in the dependencyManagement block are updated in a Maven project, but not in a Gradle project.
Describe the solution you'd like
I would like to get support in Gradle for updating BOM dependencies, similar to Maven.
Have you considered any alternatives or workarounds?
Gradle projects defining BOM dependencies in the dependencies block as "platform dependencies" are correctly updated. Dropping the dependencyManagement block altogether is definitely an alternative. However, it's not always a good one since "platform dependencies" are configuration specific. In a typical Spring Boot application, it means duplicating the BOM dependencies for each configuration you need (e.g. implementation, runtimeOnly, developmentOnly...).
Are you interested in contributing this feature to OpenRewrite?
Yes, I'm available to contribute this feature to OpenRewrite.
Hi @ThomasVitale ; Great seeing you here and thanks for the suggestion & offer to help. Let us know how we can best support you with this effort. Typically we find it helps to start an early draft PR with just the tests of what you'd like to see covered, and then we can provide guidance from there.
The recipes in this module combine the recipes for Maven and Gradle, but their actual implementations are in openrewrite/rewrite. Let me know if we should transfer this issue there, as I suspect the work would be in that repository, before it's picked up here.
@timtebeek thanks so much for your support! I guess it makes sense to transfer the issue to openrewrite/rewrite since the main work will be in that repository for the Gradle-specific recipes. Thank you! I can start by submitting a PR with the tests as you suggested.
I added a couple of tests to show the issue:
- https://github.com/openrewrite/rewrite/pull/5304
This issue is stale because it has not had any activity for 60 days. Remove question label or comment or this will be closed in two weeks. Issues may be reopened when there is renewed interest.
A PR has been submitted to address this issue by @Jenson3210 in https://github.com/openrewrite/rewrite/pull/5623. It's pending review. More context in https://github.com/openrewrite/rewrite/pull/5304#issuecomment-2971954971
Apologies! The bot didn't quite behave as we had wanted to; it wasn't support to add tags, only evaluate already tagged questions.
Hope all is well there, and thanks for the help!
I just merged that linked PR, hopefully that helps
Picking up the downstream option in
- https://github.com/openrewrite/rewrite-java-dependencies/pull/145
Thanks all! Hope that has you going. :)
Thanks so much!