From c099e97b90092ecc5af4af7d84324c745b98f363 Mon Sep 17 00:00:00 2001 From: qibaoguang Date: Sun, 12 Apr 2015 13:47:32 +0800 Subject: [PATCH] Update 72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ.md --- ...ing Loaded for use with Gradle and IntelliJ.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/IX. ‘How-to’ guides/72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ.md b/IX. ‘How-to’ guides/72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ.md index e69de29..c7351c4 100644 --- a/IX. ‘How-to’ guides/72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ.md +++ b/IX. ‘How-to’ guides/72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ.md @@ -0,0 +1,28 @@ +### 72.6.2. 使用Gradle和IntelliJ配置Spring Loaded + +如果想将Spring Loaded和Gradle,IntelliJ结合起来,那你需要付出代价。默认情况下,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`,这样不管什么时候只要文件被保存都会自动编译你的代码。