Spring Boot Version: 3.5.5
Build Tool: Gradle (Kotlin)
I have several Java projects that use a good chunk of the spring starter dependencies. Additionally, I am making use of gradle's libs.versions.toml
file for keeping track of dependency versions.
implementation(platform(libs.spring.boot.dependencies)) implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springframework.boot:spring-boot-starter-data-jpa") implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.boot:spring-boot-starter-validation") implementation("org.springframework.boot:spring-boot-starter-web") testImplementation("org.springframework.boot:spring-boot-starter-test") testImplementation("org.springframework.security:spring-security-test")
All of these resolve without issue except for spring boot devtools which I have to specify like this:
developmentOnly("org.springframework.boot:spring-boot-devtools:${libs.versions.spring.get()}")
If that version is not explicitly defined in my build.gradle.kts
file I get the following error when I try to build my project:
Execution failed for task ':bootJar'. Could not resolve all files for configuration ':developmentOnly'. Could not find org.springframework.boot:spring-boot-devtools:. Required by: root project :
Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
I recently switched from using the spring dependency-management plugin to gradles BOM support through platform
as you can see above. libs.spring.boot.dependencies
is defined in my libs.versions.toml
file as follows:
spring-boot-dependencies = {group = "org.springframework.boot", name = "spring-boot-dependencies", version.ref = "spring"}
with spring defined in the [versions]
section of libs.versions.toml
as: spring = "3.5.5"
I removed spring dependency-management at approximately the same time as I upgraded my project to Spring Boot 3.5.5. So I guess I'm unsure if this is an issue with this version of spring, if it is an issue with how gradle handles the BOM, or if I'm just doing something incorrectly here. I don't see any other discussion about this issue so maybe it is the latter but, the fact that all the other spring dependencies resolve correctly makes me think it is an issue with the devtools module specifically. That said, I'll be more than happy to close this issue if I'm just doing something wrong here or it's related to gradle.
Comment From: bclozel
I think the dependency management plugin applies the dependency management information to all available Gradle configurations (the default). You can also specify which configuration(s) you would like to target.
Here, the Gradle platform
feature is applied to the implementation
configuration. developmentOnly
is a custom, separate, Gradle configuration created by the Spring Boot plugin. Maybe the platform needs to be applied to the developmentOnly
configuration because that configuration is not within the implementation
configuration hierarchy?
Comment From: CMcDonaldDPC
Yep, I think that was it. Thanks. Looks like I have some more reading to do on exactly how the platform feature works. I'll close this.