Skip to content

Commit 1c3987d

Browse files
committed
Fix documentation of devtools Gradle scope
Update the reference documentation to suggest that devtools uses a custom `developmentOnly` scope, rather than `compileOnly`. Closes gh-14451
1 parent 5f6698e commit 1c3987d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

spring-boot-project/spring-boot-docs/src/main/asciidoc/using-spring-boot.adoc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,16 +747,23 @@ listings for Maven and Gradle:
747747
.Gradle
748748
[source,groovy,indent=0,subs="attributes"]
749749
----
750+
configurations {
751+
developmentOnly
752+
runtimeClasspath {
753+
extendsFrom developmentOnly
754+
}
755+
}
750756
dependencies {
751-
compile("org.springframework.boot:spring-boot-devtools")
757+
developmentOnly("org.springframework.boot:spring-boot-devtools")
752758
}
753759
----
754760

755761
NOTE: Developer tools are automatically disabled when running a fully packaged
756762
application. If your application is launched from `java -jar` or if it is started from a
757763
special classloader, then it is considered a "`production application`". Flagging the
758-
dependency as optional in Maven or using `compileOnly` in Gradle is a best practice that
759-
prevents devtools from being transitively applied to other modules that use your project.
764+
dependency as optional in Maven or using a custom`developmentOnly` configuration in
765+
Gradle (as shown above) is a best practice that prevents devtools from being transitively
766+
applied to other modules that use your project.
760767

761768
TIP: Repackaged archives do not contain devtools by default. If you want to use a
762769
<<using-boot-devtools-remote,certain remote devtools feature>>, you need to disable the

0 commit comments

Comments
 (0)