title: Gradle Spring Boot Project Cannot Run From IDEA
body: <p>I am struggling to set up the spring boot project that i have imported in intelliJ IDEA 2016 1.4.
          Every time i run . I get the below Exception:        </p>
  
  <pre><code>    Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
          at com.patientConnect.DemoApplication.main(DemoApplication.java:24)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
      Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
          at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          ... 6 more
  </code></pre>
  
  <p>My gradle settings (linked gradle projects,user gradle wrapper ) all looks good.</p>
  
  <pre><code>package com.Demo;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class DemoApplication {
  
      public DemoApplication() {
      }
  
      public static void main(String[] args) {
          SpringApplication.run(DemoApplication.class, args);
      }
  
  
  }
  </code></pre>
  
  <p>build.gradle:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenLocal()
          mavenCentral()
          maven {
              url 'https://plugins.gradle.org/m2/'
          }
      }
      dependencies {
          classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE'
          classpath 'gradle.plugin.com.jamesward:atom-gradle-plugin:0.0.1'
      }
  }
  
  apply plugin: 'java'
  apply plugin: 'org.springframework.boot'    
  
  repositories {
      mavenLocal()
      mavenCentral()
  }
  
  dependencies {
      compile 'org.springframework.boot:spring-boot-starter-parent:1.5.4.RELEASE'
      compile 'org.springframework.boot:spring-boot-starter-web'
      compile 'org.springframework.boot:spring-boot-devtools'
      compile 'org.springframework.boot:spring-boot-starter-security'
      compile 'org.springframework.security.oauth:spring-security-oauth2'
  
      compile 'org.apache.httpcomponents:httpclient'
      compile 'org.springframework.boot:spring-boot-starter-data-jpa'
      compile 'org.postgresql:postgresql'
      compile 'org.springframework.boot:spring-boot-starter-jdbc'
      compile 'org.hibernate:hibernate-entitymanager'
  
  
  }
  
  allprojects {
      sourceCompatibility = 1.8
      targetCompatibility = 1.8
  }
  
  
  
  import org.gradle.internal.os.OperatingSystem
  
  task devClasses(type: Exec) {
      if (OperatingSystem.current().isWindows())
          commandLine 'gradlew', '-t', 'classes'
      else
          commandLine './gradlew', '-t', 'classes'
  }
  
  task devBootRun(type: Exec) {
      if (OperatingSystem.current().isWindows())
          commandLine 'gradlew', 'bootRun'
      else
          commandLine './gradlew', 'bootRun' //, '--debug-jvm'
  }
  
  import java.util.concurrent.*
  
  task dev() &lt;&lt; {
      def devClassesFuture = Executors.newSingleThreadExecutor().submit({ devClasses.execute() } as Callable)
      def devBootRunFuture = Executors.newSingleThreadExecutor().submit({ devBootRun.execute() } as Callable)
      devClassesFuture?.get()
      devBootRunFuture?.get()
  }
  
  
  task stage {
      dependsOn build
  }
  </code></pre>