openrewrite / openrewrite/rewrite-spring

Recipe to remove versions from spring-boot managed Gradle dependencies

Open
#115 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discovery enhancement
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

An issue I've seen while upgrading spring-boot is projects declaring their own version for a dependency that spring-boot manages out of the box. Allowing spring-boot to control the version of dependencies ideally makes future upgrades easier, as they maintain a curated list of compatible dependencies.

While there certainly are cases for pinning the version by setting version properties for the dependency, when a project declares a dependency with a particular version themselves, I've found it tends to be from lack of awareness that spring-boot will manage the version for them.

For example:

// build.gradle

dependencies {
  implementation 'com.google.code.gson:gson:2.8.0'
}

Should instead be:

// build.gradle

dependencies {
  // Let spring-boot pin the version
  implementation 'com.google.code.gson:gson'
}

Such a feature could examine other BOM files as well, such as: org.springframework.cloud:spring-cloud-dependencies.

While this may be gated by the Gradle AST becoming more mature, does this seem like a feature you all would like to support?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the build.gradle examples and the linked discussion about Gradle AST maturity. Define done as a recipe that identifies dependencies managed by Spring Boot, and potentially Spring Cloud BOMs, and removes explicit versions without changing intentionally pinned dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, spring-boot
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.