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 Creating Controllers and Views Using Thymeleaf to Serve HTML

Spring boot dependencies disappear after changing dependecies to thymeleaf

Spring boot dependencies disappear after changing and refreshing dependecies from compile 'org.springframework.boot:spring-boot-starter-web:2.0.4.RELEASE' to compile 'org.springframework.boot:spring-boot-starter-thymeleaf'

3 Answers

David Sielert
David Sielert
775 Points

You have to add them both if you are using Spring boot 2+

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.0-Migration-Guide#user-content-web-starter-as-a-transitive-dependency

plugins {
    id 'java'
    id 'idea'
    id 'eclipse'
    id 'org.springframework.boot' version '2.0.6.RELEASE'
    id "io.spring.dependency-management" version "1.0.6.RELEASE"
}

group 'org.sielert'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}
dependencies {
    // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.0.6.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: '2.0.6.RELEASE'
}

@David Sielert this worked for me, thanks!

Martin Gallauner
Martin Gallauner
10,808 Points

Hi Bryan,

I have the same problem. Did you find a solution? I just contacted the treehouse support and will search for a solution in the meantime. Looks like spring-boot-starter-web isn't a dependency of spring boot thymeleaf anymore

In addition to "starter-web" dependency, add "compile group: 'org.springframework.boot', name: 'spring-boot-starter-thymeleaf', version: 'x.x.x.RELEASE' " to gradle build. It worked for me.