Disable addResources by default
Flip the default value of `addResources` for both the Maven and Gradle plugins. This effectively turns off static resources reloading and, more importantly, the pruning of duplicate resources from the target directory. As devetools is our mainstram solution for such feature, the documantion has been updated to reflect that. Closes gh-4227
This commit is contained in:
@@ -310,23 +310,23 @@ To run a project in place without building a jar first you can use the "`bootRun
|
||||
$ gradle bootRun
|
||||
----
|
||||
|
||||
By default, running this way makes your static classpath resources (i.e. in
|
||||
`src/main/resources` by default) reloadable in the live application, which can be helpful
|
||||
at development time. Making static classpath resources reloadable means that `bootRun`
|
||||
does not use the output of the `processResources` task, i.e., when invoked using
|
||||
`bootRun`, your application will use the resources in their unprocessed form.
|
||||
|
||||
You can disable the direct use of your static classpath resources. This will mean that
|
||||
the resources are no longer reloadable but the output of the `processResources` task will
|
||||
be used. To do so, set `addResources` on the `bootRun` task to `false`:
|
||||
If <<using-spring-boot.adoc#using-boot-devtools,`devtools`>> has been added to your project
|
||||
it will automatically monitor your application for changes. Alternatively, you can also
|
||||
run the application so that your static classpath resources (i.e. in `src/main/resources`
|
||||
by default) are reloadable in the live application, which can be helpful at development
|
||||
time.
|
||||
|
||||
[source,groovy,indent=0,subs="verbatim,attributes"]
|
||||
----
|
||||
bootRun {
|
||||
addResources = false
|
||||
addResources = true
|
||||
}
|
||||
----
|
||||
|
||||
Making static classpath resources reloadable means that `bootRun` does not use the output
|
||||
of the `processResources` task, i.e., when invoked using `bootRun`, your application will
|
||||
use the resources in their unprocessed form.
|
||||
|
||||
|
||||
|
||||
[[build-tool-plugins-gradle-global-configuration]]
|
||||
|
||||
@@ -1858,15 +1858,16 @@ requests). To switch that on in a Spring Boot application you just need to set
|
||||
=== Reload static content
|
||||
There are several options for hot reloading. Running in an IDE (especially with debugging
|
||||
on) is a good way to do development (all modern IDEs allow reloading of static resources
|
||||
and usually also hot-swapping of Java class changes). The
|
||||
<<build-tool-plugins.adoc#build-tool-plugins, Maven and Gradle plugins>> also
|
||||
support running from the command line with reloading of static files. You can use that
|
||||
with an external css/js compiler process if you are writing that code with higher level
|
||||
tools.
|
||||
and usually also hot-swapping of Java class changes).
|
||||
|
||||
The <<using-spring-boot.adoc#using-boot-devtools,`spring-boot-devtools`>> module is also
|
||||
available with support for fast application restarts and LiveReload.
|
||||
|
||||
Finally, the <<build-tool-plugins.adoc#build-tool-plugins, Maven and Gradle plugins>> can
|
||||
be configured to support running from the command line with reloading of static files. You
|
||||
can use that with an external css/js compiler process if you are writing that code with
|
||||
higher level tools.
|
||||
|
||||
|
||||
|
||||
[[howto-reload-thymeleaf-template-content]]
|
||||
|
||||
Reference in New Issue
Block a user