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 trialAlka Gupta
706 PointsGetting 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
Java Web Development Techdegree Graduate 22,175 PointsI 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:
- GitHub issue about using
plugins
notation
https://github.com/spring-projects/spring-boot/issues/1567
- Tweet about new plugin style problem solved
Alka Gupta
706 PointsThanks Alex! It works like a charm.
Daniel Mora
2,975 PointsWorked!
Vimal Anbalagan
2,022 PointsWorked !!. Thanks a lot!!
V School Learning
25,025 PointsThank you. This fixed it for me.