Recommend against using compileOnly in favour of providedRuntime
Closes gh-5461
This commit is contained in:
parent
409f160150
commit
93ceb980bc
|
@ -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")
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue