Recommend against using compileOnly in favour of providedRuntime

Closes gh-5461
This commit is contained in:
Andy Wilkinson 2016-07-19 15:40:57 +01:00
parent 409f160150
commit 93ceb980bc
2 changed files with 7 additions and 6 deletions

View File

@ -267,8 +267,8 @@ To build and run a project artifact, you can type the following:
---- ----
To build a war file that is both executable and deployable into an external container, To build a war file that is both executable and deployable into an external container,
you need to mark the embedded container dependencies as belonging to a configuration you need to mark the embedded container dependencies as belonging to the war plugin's
named "`providedRuntime`", e.g: `providedRuntime` configuration, e.g.:
[source,groovy,indent=0,subs="verbatim,attributes"] [source,groovy,indent=0,subs="verbatim,attributes"]
---- ----
@ -285,10 +285,6 @@ named "`providedRuntime`", e.g:
maven { url "http://repo.spring.io/libs-snapshot" } maven { url "http://repo.spring.io/libs-snapshot" }
} }
configurations {
providedRuntime
}
dependencies { dependencies {
compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")

View File

@ -2917,6 +2917,11 @@ And if you're using Gradle:
} }
---- ----
NOTE: If you are using a version of Gradle that supports compile only dependencies (2.12
or later), you should continue to use `providedRuntime`. Among other limitations,
`compileOnly` dependencies are not on the test classpath so any web-based integration
tests will fail.
If you're using the <<build-tool-plugins.adoc#build-tool-plugins, Spring Boot build tools>>, If you're using the <<build-tool-plugins.adoc#build-tool-plugins, Spring Boot build tools>>,
marking the embedded servlet container dependency as provided will produce an executable war marking the embedded servlet container dependency as provided will produce an executable war
file with the provided dependencies packaged in a `lib-provided` directory. This means file with the provided dependencies packaged in a `lib-provided` directory. This means