Description
Gradle now supports version catalogs, which have the advantage of generating type-safe accessors to reference the dependencies, allowing, for example
testImplementation(libs.mockk)
with support for auto-completion.
Such version catalogs can be defined in the build itself, but can also be published and then consumed by other projects. Micronaut for example does that, allowing to do in the settings files
versionCatalogs {
create("mn") {
from("io.micronaut:micronaut-bom:3.3.0")
}
}
and then in the build files
dependencies {
implementation(mn.picocli)
}
Overriding versions from the imported catalog is supported too.
Publishing such a version catalog along with the Spring Boot BOM would be a nice feature, which would allow migrating away from the spring dependencies plugin, now that gradle seems to support its features (with version catalogs and with the platform plugin), and benefit from the additional advantage of type-safe accessors for dependencies.