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 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

Jeroen Oosterwijk
Jeroen Oosterwijk
5,456 Points

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.