rewrite-spring icon indicating copy to clipboard operation
rewrite-spring copied to clipboard

Recipe to remove versions from spring-boot managed Gradle dependencies

Open billkoch opened this issue 3 years ago • 0 comments

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?

billkoch avatar Nov 05 '21 21:11 billkoch