1

So I usually use Eclipse for my Spring Boot setup and it works just fine.Lately, I have tried many times but failed to run Spring Boot projects on IntelliJ. What happens is that the app launches and just stops automatically. My gradle.build is as follows



        buildscript {
        ext {
            springBootVersion = '1.3.6.RELEASE'
        }
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        }
    }

    apply plugin: 'groovy'
    apply plugin: 'eclipse-wtp'
    apply plugin: 'spring-boot'
    apply plugin: 'war'


    war {
        baseName = 'demo12'
        version = '0.0.1-SNAPSHOT'
    }
    sourceCompatibility = 1.8
    targetCompatibility = 1.8

    repositories {
        mavenCentral()
    }

    configurations {
        providedRuntime
    }

    dependencies {

        compile group: 'org.spockframework', name: 'spock-spring', version: '1.0-groovy-2.4'
        compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.4'
        compile group: 'com.google.guava', name: 'guava', version: '19.0'


        compile('org.springframework.boot:spring-boot-starter-actuator')
        compile('org.springframework.boot:spring-boot-actuator-docs')
        compile('org.springframework.boot:spring-boot-starter-cache')
        compile('org.springframework.boot:spring-boot-starter-data-jpa')
        compile('org.springframework.boot:spring-boot-devtools')
        compile('org.springframework.boot:spring-boot-starter-security')
        compile('org.springframework.boot:spring-boot-starter-thymeleaf')
        compile('org.springframework.boot:spring-boot-starter-web')
        compile('org.codehaus.groovy:groovy')
        runtime('com.h2database:h2')
        runtime('mysql:mysql-connector-java')

        providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
        testCompile('org.springframework.boot:spring-boot-starter-test')
    }


    eclipse {
        classpath {
             containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
             containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
        }
    }

The following is outputted straight from the console when the app is fired up:



  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.6.RELEASE)

2016-07-26 20:50:28.268  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : Starting Demo12Application on Ankushs-MacBook-Pro.local with PID 13779 (/Users/Ankush/Downloads/intellij/demo12/build/classes/main started by Ankush in /Users/Ankush/Downloads/intellij/demo12)
2016-07-26 20:50:28.284  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : The following profiles are active: dev
2016-07-26 20:50:28.497  INFO 13779 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c2a25de: startup date [Tue Jul 26 20:50:28 IST 2016]; root of context hierarchy
2016-07-26 20:50:31.463  INFO 13779 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2016-07-26 20:50:31.495  INFO 13779 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
    name: default
    ...]
2016-07-26 20:50:31.586  INFO 13779 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate Core {4.3.11.Final}
2016-07-26 20:50:31.588  INFO 13779 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000206: hibernate.properties not found
2016-07-26 20:50:31.591  INFO 13779 --- [  restartedMain] org.hibernate.cfg.Environment            : HHH000021: Bytecode provider name : javassist
2016-07-26 20:50:31.807  INFO 13779 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
2016-07-26 20:50:32.077  INFO 13779 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2016-07-26 20:50:32.166  INFO 13779 --- [  restartedMain] o.h.h.i.ast.ASTQueryTranslatorFactory    : HHH000397: Using ASTQueryTranslatorFactory
2016-07-26 20:50:32.295  INFO 13779 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2016-07-26 20:50:32.299  INFO 13779 --- [  restartedMain] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete
2016-07-26 20:50:33.880  INFO 13779 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2016-07-26 20:50:33.941  INFO 13779 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-07-26 20:50:33.953  INFO 13779 --- [  restartedMain] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-07-26 20:50:34.070  INFO 13779 --- [  restartedMain] com.example.Demo12Application            : Started Demo12Application in 6.649 seconds (JVM running for 8.064)
2016-07-26 20:50:34.073  INFO 13779 --- [       Thread-8] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@1c2a25de: startup date [Tue Jul 26 20:50:28 IST 2016]; root of context hierarchy
2016-07-26 20:50:34.076  INFO 13779 --- [       Thread-8] o.s.c.support.DefaultLifecycleProcessor  : Stopping beans in phase 0
2016-07-26 20:50:34.084  INFO 13779 --- [       Thread-8] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2016-07-26 20:50:34.085  INFO 13779 --- [       Thread-8] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2016-07-26 20:50:34.086  INFO 13779 --- [       Thread-8] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000227: Running hbm2ddl schema export
2016-07-26 20:50:34.087  INFO 13779 --- [       Thread-8] org.hibernate.tool.hbm2ddl.SchemaExport  : HHH000230: Schema export complete

Process finished with exit code 0

I have been trying to switch to IntelliJ for months,but for some reason this crap comes up every time.Any help will be GREATLY appreciated . Thanks .

Ankush92
  • 401
  • 1
  • 9
  • 20
  • When you say 'app is fired up', what do you mean? How are you running it? Is your project configured with Gradle in IntelliJ? Do you have a Gradle Projects tab? Are you running bootRun or something else? Gradle wrapper or not? How is the Gradle plugin configured? You need to provide some details if you want help on this issue. – JudgingNotJudging Jul 26 '16 at 15:51
  • When I say that app is fired up, I mean that I go to the class annotated with @SpringBootApplication , right click, and run it . Yes,The project is configured with Gradle in IntelliJ . Also, I just changed tomcat from providedRuntime to compile , and now it works. – Ankush92 Jul 26 '16 at 15:56

0 Answers0