Here it is suggested to apply the io.spring.dependency-management plugin using a legacy method to apply the plugin (source -> here).

Apply the plugin in this way, doesn't give access to the API the plugin offers to access for instance, the managedVersions as explained here.

Comment From: wilkinsona

There are pros and cons to the two approaches. As the dependency management plugin is a dependency of Spring Boot's plugin, using apply allows the plugin to be applied without specifying its version. The alternative is discussed elsewhere in the documentation.

Apply the plugin in this way, doesn't give access to the API the plugin offers

I'm not aware of any differences in terms of the API that's available when using one of the two methods of applying the plugin. Can you please provide a minimal example that reproduces the behavior you've described?

Comment From: SimoneGiusso

I'm not aware of any differences in terms of the API that's available when using one of the two methods of applying the plugin. Can you please provide a minimal example that reproduces the behavior you've described?

You can use this project and simply add dependencyManagement.managedVersions["org.springframework:spring-core"]!! here, between line 53 and 54 and run ./gradlew clean build assemble. It should fail.

Comment From: wilkinsona

Thanks. That's a limitation of the Kotlin DSL that's briefly mentioned in Gradle's documentation. As shown in the documentation for Boot's Gradle plugin that I linked to above, you need to use the the<T>() function:

the<io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension>().managedVersions["org.springframework:spring-core"]

Given this, and the pros and cons discussed above, I don't think we should make a change here. This may change in the future depending on https://github.com/spring-io/initializr/issues/1428.