我在gradle插件中使用SpringBoot1.3.2。在我的多部分项目中,热交换/重新加载HTML/JS/CSS文件不起作用。
/resources
|-wro.groovy
|-application.yml
|-/templates/(all *.html files and index.html)
|-/static/
|-/js/
|-/css/application.yml
server:
port: 8080
spring:
thymeleaf:
cache: false
prefix: classpath:/templates/
suffix: .html
enabled: true
encoding: UTF-8
mode: HTML5在te中也使用了: wro4j,胸腺嘧啶,AngularJS
gradle.build的一部分
buildscript {
ext { springBootVersion = '1.3.2.RELEASE' }
repositories {
maven {
url "https://ourartifactoryUrl/plugins-release"
credentials {
// artifactory log and pass
}
}
}
dependencies {
classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: springBootVersion
classpath group: 'io.spring.gradle', name: 'dependency-management-plugin', version: '0.5.2.RELEASE'
classpath group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '3.1.+'
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}
apply plugin: 'spring-boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'idea'
apply plugin: 'application'
apply plugin: 'propdeps'
apply plugin: 'propdeps-maven'
apply plugin: 'propdeps-idea'
apply plugin: 'propdeps-eclipse'
...
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-jetty")
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-redis")
compile("org.springframework.boot:spring-boot-devtools")
}用:gradle :web-admin:bootRun执行的项目
Update/Answer:
在上网冲浪和阅读弹簧启动文件之后,我发现了一个窍门。因此,我只需在gradle.build文件中添加几行代码,就会出现问题:
// Used by 'Spring Boot Gradle Plugin' in combination with 'Devtools' makes HTML/JS/CSS reloadable.
bootRun {
addResources = true
}发布于 2016-02-05 11:29:22
在上网冲浪和阅读弹簧启动文件之后,我发现了一个窍门。因此,在使用devtools和spring gradle-plugin时,我只需要在我的gradle.build文件中添加几行代码:
// Used by 'Spring Boot Gradle Plugin' in combination with 'Devtools' makes HTML/JS/CSS reloadable.
bootRun {
addResources = true
}发布于 2016-07-14 10:34:27
我也遇到了同样的问题,我通过将应用程序属性中的spring.thymeleaf.cache设置为false来解决这个问题。
如何解决问题
在spring.thymeleaf.cache=false文件中添加application.properties
https://stackoverflow.com/questions/35200889
复制相似问题