Skip to content

Commit 75a202e

Browse files
author
Phillip Webb
committed
Add Spring Loaded, Gradle, IntelliJ "How-To"
Fixes spring-projectsgh-823
1 parent c2c31cd commit 75a202e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

spring-boot-docs/src/main/asciidoc/howto.adoc

+38
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,44 @@ general mechanism to ensure that would be safe for a running application anyway,
14591459
would only ever be a development time trick probably).
14601460

14611461

1462+
[[howto-reload-springloaded-gradle-and-intellij]]
1463+
==== Configuring Spring Loaded for use with Gradle and IntelliJ
1464+
You need to jump though a few hoops if you want to use Spring Loaded in combination with
1465+
Gradle and IntelliJ. By default, IntelliJ will compile classes into a different location
1466+
than Gradle, causing Spring Loaded monitoring to fail.
1467+
1468+
To configure IntelliJ correctly you can use the `idea` Gradle plugin:
1469+
1470+
[source,groovy,indent=0,subs="verbatim,attributes"]
1471+
----
1472+
buildscript {
1473+
repositories { mavenCentral() }
1474+
dependencies {
1475+
classpath "org.springframework.boot:spring-boot-gradle-plugin:{spring-boot-version}"
1476+
classpath 'org.springframework:springloaded:1.2.0.RELEASE'
1477+
}
1478+
}
1479+
1480+
apply plugin: 'idea'
1481+
1482+
idea {
1483+
module {
1484+
inheritOutputDirs = false
1485+
outputDir = file("$buildDir/classes/main/")
1486+
}
1487+
}
1488+
1489+
// ...
1490+
1491+
----
1492+
1493+
NOTE: Intellij must be configured to use the same Java version as the command line Gradle
1494+
task and `springloaded` *must* be included as a `buildscript` dependency.
1495+
1496+
You can also additionally enable ``Make Project Automatically'' inside Intellij to
1497+
automatically compile your code whenever a file is saved.
1498+
1499+
14621500

14631501
[[howto-build]]
14641502
== Build

0 commit comments

Comments
 (0)