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 with Hibernate Integrating Hibernate with Spring Revisiting Giflib

Revisiting Giflib - Incorrect/Outdated build.gradle file

There seems to be a problem with the build.gradle file that is provided. I get the following error in my terminal:

Build file 'C:\Users\Windows 8\IdeaProjects\giflib-hibernate\build.gradle' line: 15

A problem occurred evaluating root project 'giflib-hibernate'.

Failed to apply plugin [class 'io.spring.gradle.dependencymanagement.DependencyManagementPlugin'] Could not create task of type 'DependencyManagementReportTask'.

Here's the build.gradle file provided:

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

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

apply plugin: 'spring-boot'

apply plugin: 'java'

repositories { mavenCentral() }

dependencies { compile 'org.springframework.boot:spring-boot-starter-thymeleaf' compile 'org.hashids:hashids:1.0.1' compile 'org.springframework:spring-orm:4.2.5.RELEASE' compile 'org.hibernate:hibernate-core:5.2.1.Final' compile 'org.apache.tomcat:tomcat-dbcp:8.0.32' compile 'com.h2database:h2:1.4.191' }

2 Answers

After a bit of fiddling around I got it working myself. Here's the build.gradle file I used:

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 'com.teamtreehouse'
version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

// Specify the location where our dependencies will be found
repositories {
    mavenCentral()
}

dependencies {
    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'
    compile group: 'org.hashids', name: 'hashids', version: '1.0.1'
    compile group: 'org.springframework', name: 'spring-orm', version: '4.2.5.RELEASE'
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.1.Final'
    compile group: 'org.apache.tomcat', name: 'tomcat-dbcp', version: '8.0.32'
    compile group: 'com.h2database', name: 'h2', version: '1.4.191'
}

Thank you so much!

Michel Stroobants
Michel Stroobants
5,014 Points

After pulling from the github repo, just editing the gradle.build file did not work for me. After fooling around I got it to work though! All I did was delete the gradle-directory in the giflib-hibernate-directory and reloaded gradle! Gradle did download again, but it works! I had to do some minor adjustment though in the import statements.