I am using spring-boot-gradle-plugin:2.4.13 with Gradle 5.6.4.
We are using the "configurations" block of the dependency-management-plugin to limit dependency management to a set of specific Gradle configurations, as shown below
apply plugin: "io.spring.dependency-management"
dependencyManagement {
configurations(compile,compileOnly, runtime,annotationProcessor) {
imports {
mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
}
}
}
This works as expected however, if we subsequently apply the org.springframework.boot plugin, then the specified configurations are ignored and dependency management is used for all configurations.
I see that the spring-boot-gradle-plugin performs this action in response to the DependencyManagementPlugin being applied, which seems like it might be the issue.
So I would like to know whether it is possible to apply the org.springframework.boot plugin such that dependency management is only used within a specific set of configurations.
I don't think what you want to do is possible. I don't see anything in the documentation of the Spring Boot Gradle plugin that allows this type of customization. With that said, I think your only option is to not use the Spring Dependency Management plugin and use Gradle platform instead. This will allow you do do the following:
dependencies {
implementation(platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES))
}
This will allow you to apply the Spring Boot Gradle plugin, but choose which configurations to apply its BOM it to.