-
Notifications
You must be signed in to change notification settings - Fork 41k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use plugins DSL consistently in Spring Boot Gradle Plugin docs #34048
Comments
I'm not sure that we should do this across the board. One disadvantage is that a version number for the dependency management plugin needs to be declared when using the plugins DSL. We mention this in the docs at the moment:
There are a few areas in the docs where we could use the plugins DSL (applying the |
I would say it is more explicit/verbose than a disadvantage. I suppose the disadvantage here is that the version of the plugin Spring Boot supports may or may not align with the version of the Dependency Management plugin specified by the user. But since the Spring Boot plugin declares a dependency on the Dependency Management plugin, then the version Spring Boot provides can override the users version since standard Gradle dependency resolution applies; assuming Spring Boot provides a more recent version than what the user specifies. For example, the following illustrates the above: plugins {
java
id("org.springframework.boot") version "3.0.2"
id("io.spring.dependency-management") version "1.0.9.RELEASE"
}
Additionally, I am wondering if the Spring Boot plugin really needs to declare a dependency on the Dependency Management plugin anyways since the Spring Boot plugin does not depend on it as part of its public API, but rather reacts to its application when applied. Then the disadvantage is more or less moot since you can invoke buildscript {
configurations.configureEach {
exclude(group = "io.spring.dependency-management", module = "io.spring.dependency-management.gradle.plugin")
}
}
plugins {
java
id("org.springframework.boot") version "3.0.2"
} Finally, there is this part (bottom) in the Gradle documentation Minimizing the use of external libraries:
Theoretically (my understanding), the dependency on Dependency Management would no longer 'leak' onto the build environment therefore forcing the user to define a version anyways. |
Closed by 81882ec. |
The current docs mix the plugins DSL and legacy plugin application:
https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/
Per the Gradle docs: https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application
I think the Spring Boot Gradle Plugin docs should use the plugins DSL consistently since that is the recommended approach from Gradle (my understanding).
So, instead of:
Do:
The plugins DSL is also what is used when generating a project using Spring Initializr.
The text was updated successfully, but these errors were encountered: