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

Tornike Shelia
Tornike Shelia
2,781 Points

I don't have an application folder and also there is an error

build.gradle -

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

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

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

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

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

error :

Error:Could not find org.springframwork.boot:spring-boot-gradle-plugin:1.2.6.RELEASE.
Searched in the following locations:

https://repo1.maven.org/maven2/org/springframwork/boot/spring-boot-gradle-plugin/1.2.6.RELEASE/spring-boot-gradle-plugin-1.2.6.RELEASE.pom

https://repo1.maven.org/maven2/org/springframwork/boot/spring-boot-gradle-plugin/1.2.6.RELEASE/spring-boot-gradle-plugin-1.2.6.RELEASE.jar

Required by:
project :

I do realise that 1.2.6.RELEASE is an older version and I changed it to - 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.0.M7'

Which I think the the newest version but still same error .

2 Answers

In case you or anyone else is still struggling with this, this code is what worked for me:

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

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

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

sourceCompatibility = 1.8

repositories { mavenCentral() }

dependencies { compile "org.springframework.boot:spring-boot-starter-web:1.5.10.RELEASE"

}

Nikolay Egov
Nikolay Egov
6,951 Points

Thanks a lot! Initially I got a whole bunch of errors and exceptions but this worked great.

The teacher notes in the previous video said that buildscript was outdated and shouldn't be used. Regarding the missing Tasks/Application folder in the Gradle panel; I didn't have it first, but suddenly it appeared. I guess related to the sync finished.