Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java

Alka Gupta
Alka Gupta
706 Points

Getting Error:The supplied build action failed with an exception. after adding the gradle plugin step in last video

Here is my build file

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

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

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

sourceCompatibility = 1.5

repositories { mavenCentral() }

dependencies { compile 'org.springframework.boot:spring-boot-starter-web:1.2.6.RELEASE' }

After refresh I get above error. So I don't see application folder.

5 Answers

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,161 Points

I believe you have the same problem as here. Check this answer please

https://teamtreehouse.com/community/error-on-refreshing-gradle

I try to write what the problem is about. If you are interested, read below. If not just use solution above.

The problem description

In Intellijdea right now by default Gradle projects are created with Gradle 3+ versions, i.e when you open in your project tree file called gradle/wrapper/gradle-wrapper.properties you will see the following Or almost the same

#Sat Dec 31 07:34:13 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip

As you can see Gradle version is 3.1.

And the problem is that this buildscript style that you've provided above:

group 'com.teamtreehouse'

version '1.0-SNAPSHOT'

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

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

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web:1.2.6.RELEASE'
}

It WILL NOT WORK with Gradle 3+.

From here you have two ways:

I. To use new plugins notations. See link above. Example:

plugins {
    id 'java'
    id 'idea'
    id 'org.springframework.boot' version '1.4.3.RELEASE'
}

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

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web'
}

II. To change Gradle back to 2.+ version (not recommended).

This can be done by changing gradle/wrapper/gradle-wrapper.properties file to Gradle 2.9 version e.g:

#Sat Dec 31 07:34:13 CET 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.9-all.zip

Then it should work.

Additional Info

Just in case you are interested , this buildscript notation is very old and has to be removed, since from Spring boot 1.4.2 I think we can use simple plugins notation.

NOTE: It won't work with earlier version though.

For more info see these two posts:

  1. GitHub issue about using plugins notation

https://github.com/spring-projects/spring-boot/issues/1567

  1. Tweet about new plugin style problem solved

https://twitter.com/ankinson/status/796062272363888640

Alka Gupta
Alka Gupta
706 Points

Thanks Alex! It works like a charm.

Worked!

Worked !!. Thanks a lot!!

Thank you. This fixed it for me.