title: IntelliJ fails to start Spring Boot/Gradle application when using Spring Boot developer tools
body: <p>I have a Spring Boot application which fails to start in IntelliJ 2017.1.5, as soon as I add the Spring Boot developer tools to the Gradle build like this:</p>
  
  <pre><code>dependencies {
    compile("org.springframework.boot:spring-boot-starter-web")
    compile("org.apache.httpcomponents:httpclient:4.5.3")
    compile("com.fasterxml.jackson.core:jackson-databind:2.8.8.1")
    compile("commons-validator:commons-validator:1.6")
  
    // This line breaks IntelliJ compatibility:
    optional("org.springframework.boot:spring-boot-devtools")
  
    optional("org.springframework.boot:spring-boot-configuration-processor")
    testCompile("org.springframework.boot:spring-boot-starter-test")
    testCompile("junit:junit:4.12")
  }
  </code></pre>
  
  <p>Without the <code>spring-boot-devtools</code> everything is fine, as soon as I add them, starting the application (after refreshing the Gradle project in IntelliJ) fails with a <code>NoClassDefFoundError</code>:</p>
  
  <pre><code>Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/web/client/RestTemplateBuilder
      at java.lang.Class.getDeclaredMethods0(Native Method)
      at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
      at java.lang.Class.getMethod0(Class.java:3018)
      at java.lang.Class.getMethod(Class.java:1784)
      at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.client.RestTemplateBuilder
      at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      ... 7 more
  </code></pre>
  
  <p>I'm pretty sure it's an IntelliJ issue, because the same application runs fine in Eclipse with the Spring Boot developer tools enabled.</p>
  
  <p>Any ideas how to fix this?</p>