chi*_*idx 6 java gradle maven spring-boot spring-boot-devtools
我使用 IntelliJ 创建了一个简单的 Spring Boot 应用程序,该应用程序使用 Spring Boot Devtools 作为依赖项,使用 Gradle 作为构建自动化选项:Use default gradle wrapper. 但是,Devtools 似乎不起作用。当我更改我的 html 文件时,即使我多次刷新页面也不会更新。我使用Spring Boot Devtools 文档作为参考。
我的application.properties是空的
这是我的build.gradle:
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile('org.springframework.boot:spring-boot-starter-web')
compile("org.springframework.boot:spring-boot-devtools")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)
有趣的事实:我尝试了几个 Spring Boot 版本(从1.5.12.RELEASE直到2.1.0.RELEASE),但结果仍然相同。
但是当我从 Gradle 切换到 Maven 时,Devtools 出人意料地工作了!
有什么线索吗?我想使用 Gradle,而不是 Maven。
附加信息:
openjdk 11 2018-09-25java version 1.8.0__151./gradlew bootRunmvn spring-boot:run| 归档时间: |
|
| 查看次数: |
1166 次 |
| 最近记录: |