openrewrite / openrewrite/rewrite-spring
Recipe to remove versions from spring-boot managed Gradle dependencies
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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