spring_reference/IX. ‘How-to’ guides/72.6.2. Configuring Spring ...

29 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 72.6.2. 使用Gradle和IntelliJ配置Spring Loaded
如果想将Spring Loaded和GradleIntelliJ结合起来那你需要付出代价。默认情况下IntelliJ将类编译到一个跟Gradle不同的位置这会导致Spring Loaded监控失败。
为了正确配置IntelliJ你可以使用`idea` Gradle插件
```gradle
buildscript {
repositories { jcenter() }
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.0.BUILD-SNAPSHOT"
classpath 'org.springframework:springloaded:1.2.0.RELEASE'
}
}
apply plugin: 'idea'
idea {
module {
inheritOutputDirs = false
outputDir = file("$buildDir/classes/main/")
}
}
// ...
```
**注**IntelliJ必须配置跟命令行Gradle任务相同的Java版本并且springloaded必须作为一个buildscript依赖被包含进去。
此外你也可以启用Intellij内部的`Make Project Automatically`,这样不管什么时候只要文件被保存都会自动编译你的代码。