Recommend using compileOnly rather than the propdeps plugin

Closes gh-12573
This commit is contained in:
Andy Wilkinson 2018-03-23 17:11:42 -04:00
parent 1145eec2b2
commit 0c0245014c
3 changed files with 5 additions and 9 deletions

View File

@ -731,13 +731,12 @@ an optional dependency, for example with Maven you would add:
</dependency>
----
With Gradle, you can use the https://github.com/spring-gradle-plugins/propdeps-plugin[propdeps-plugin]
and specify:
With Gradle you would add:
[source,groovy,indent=0,subs="verbatim,quotes,attributes"]
----
dependencies {
optional "org.springframework.boot:spring-boot-configuration-processor"
compileOnly "org.springframework.boot:spring-boot-configuration-processor"
}
compileJava.dependsOn(processResources)

View File

@ -47,7 +47,6 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson;
:spring-data-mongo-javadoc: http://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb
:spring-data-rest-javadoc: http://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest
:gradle-userguide: http://www.gradle.org/docs/current/userguide
:propdeps-plugin: https://github.com/spring-projects/gradle-plugins/tree/master/propdeps-plugin
:ant-manual: http://ant.apache.org/manual
:code-examples: ../java/org/springframework/boot
:test-examples: ../../test/java/org/springframework/boot

View File

@ -772,17 +772,15 @@ devtools support, simply add the module dependency to your build:
[source,groovy,indent=0,subs="attributes"]
----
dependencies {
compile("org.springframework.boot:spring-boot-devtools")
compileOnly("org.springframework.boot:spring-boot-devtools")
}
----
NOTE: Developer tools are automatically disabled when running a fully packaged
application. If your application is launched using `java -jar` or if it's started using a
special classloader, then it is considered a "`production application`". Flagging the
dependency as optional is a best practice that prevents devtools from being transitively
applied to other modules using your project. Gradle does not support `optional`
dependencies out-of-the-box so you may want to have a look to the
{propdeps-plugin}[`propdeps-plugin`] in the meantime.
dependency as optional in Maven or using `compileOnly` in Gradle is a best practice that
prevents devtools from being transitively applied to other modules using your project.
TIP: repackaged archives do not contain devtools by default. If you want to use
<<using-boot-devtools-remote,certain remote devtools feature>>, you'll need to disable the