Open hantsy opened 1 day ago
I'm not sure there are a lot of benefits in doing this. Also see this discussion in Spring Boot: https://github.com/spring-projects/spring-boot/issues/29588
@bclozel This issue could be under project https://github.com/spring-io/initializr, what I want it the generated gradle project from start.spring.io using gradle/libs.versions.toml
to manage the dependencies and versions in a central place.
Like @bclozel, I don't think this should be addressed here (or in https://github.com/spring-io/initializr).
For this to be beneficial, we'd have to extract the versions that are currently published in spring-boot-dependencies
and create a version catalog from them. That's a significant amount of work. If it's going to be done anywhere, it should be done in Spring Boot which is what https://github.com/spring-projects/spring-boot/issues/29588 is already tracking.
Most of the dependencies are managed by Spring Boots spring-boot-dependencies
, so there are not a lot of version numbers in a typical build.gradle
file generated by start.spring.io. For example, I generated a "typical" application and the build file looks like this:
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.4'
id 'io.spring.dependency-management' version '1.1.6'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(23)
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}
The only versions in here are the two plugins, and I'm not sure you can use the version catalog for them.
There are a few dependencies on start.spring.io which are not managed by spring-boot-dependencies
, but I don't think there's much value in creating a versions catalog for them.
However, if Spring Boot provides a version catalog in the future, start.spring.io will use it.
Given there are not many versions in the build file, what's your need for the version catalog @hantsy ?
Centralize the dependencies and versions in the
gradle/libs.versions.toml
, and it also can be recognized by Github dependenta, etc.See: https://docs.gradle.org/current/userguide/platforms.html