Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Spring Components and Configuring Our App Adding a Spring Configuration File

Emanuel Vasconcelos
Emanuel Vasconcelos
4,248 Points

When I run bootrun I get a build failed with an exception error

I tried to follow as best as I can the lessons but when I execute the bootrun command some strange things start to happen. I'm able to see the Whitelabel Error Page at localhost:8080 but I have noticed that the terminal is showing me the following error message:

:bootRun FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_144\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 47.593 secs
Process 'command 'C:\Program Files\Java\jdk1.8.0_144\bin\java.exe'' finished with non-zero exit value 1
07:40:13 AM: External task execution finished 'bootRun'.

I think it's a problem related to my jdk but I don't know how to fix it. Here's my gradle code:

group 'com.emanuel'
version '1.0-SNAPSHOT'

buildscript{
    repositories{
        mavenCentral()
    }
    dependencies{
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.6.RELEASE'
    }
}

apply plugin: 'java'
apply plugin: 'spring-boot'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
  compile 'org.springframework.boot:spring-boot-starter-web:1.5.6.RELEASE'
}
And here's my AppConfig.java

package com.emanuel.giftlib;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

@EnableAutoConfiguration
public class AppConfig {
    public static void main (String [] args){
        SpringApplication.run(AppConfig.class,args);

    }
}

Could someone please tell me what's going on. I'm completely new to this and I know that I won't be able to continue the course without fixing this issue.

Thanks in advance.

stefan dumitru
stefan dumitru
305 Points

Same problem here. I really don't understand why the heck they choose gradle over maven when 80% of the tutorials online use maven. My company uses maven, other people I know doing java dev use maven. Yet here I am, stuck in the first 10minutes of the tutorial :)