I am trying to do this <https://docs.spring.io/spr...
# gradle
b
I am trying to do this https://docs.spring.io/spring-boot/docs/2.0.0.RELEASE/gradle-plugin/reference/html/#managing-dependencies-using-in-isolation in my build.gradle.kts file but i get a compile error saying that dependencyManagement does not exist. is this too dynamic for kotlin or is there a solution?
c
It will only be there if you declare spring dependency management plugin in
plugins {}
block, also dependency management is no longer implicit, you have to explicitly declare it. If you did declare it but haven't used
plugins {}
mechanism you can configure it like this:
Copy code
plugins {
// other stuff
	id("org.springframework.boot") version "2.0.0.RELEASE"
	id("io.spring.dependency-management") version "1.0.4.RELEASE"
}

// if you declared spring dep management plugin in buildscript use this version:
// configure<DependencyManagementExtension> {
// otherwise, if you declared it in `plugins {}` block, like I show above, following will work:

dependencyManagement {
	imports {
		mavenBom(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
	}
}
b
That goal according to section 3.2 here is to not declare it in plugins. Is that doc wrong?
«The Spring Boot plugin’s dependency on the dependency management plugin «
so it looks like either way I have to specify the dependency-management plugin as a plugin with its verison. It is not a dependency on the spring-boot plugin?
c
It was earlier, but after 2.0, boot plugin just reacts to dependency management plugin if it is present instead of implicitly depending on it.. See here: https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#dependency-management
b
Thanks!
c
Sure 🙂
That goal according to section 3.2 here is to not declare it in plugins. Is that doc wrong?
No, it doesn't say not to declare it, it says not to apply it there, the example declares it in
plugins {}
but specifies
apply false
, then the plugin is applied with
apply { plugin("io.spring.dependency-management") }
(I've translated the doc to kotlin-dsl, since that seems to be what you're using).