buildscript {
ext {
springBootVersion = '1.3.6.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("org.springframework:springloaded:1.2.6.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'idea'
jar {
baseName = 'spring-boot-blog'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-validation')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.thymeleaf:thymeleaf-spring4:3.0.0.RELEASE')
compile('org.thymeleaf:thymeleaf:3.0.0.RELEASE')
runtime('mysql:mysql-connector-java')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
这是我的build配置,设置了Idea的自动编译,然后在命令行用./gradlwe bRun但是没效果.
不知道热加载是不是指的这种修改后自动运行。
Spring boot 提供了devtools,添加devtools的依赖即可
Maven:
Gradle:
eclipse修改保存后可以自动重新运行
IDEA make Project(ctrl+F9)后可以自动重新运行
参考:http://docs.spring.io/spring-...