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 Intro to Java Web Development with Spark Diving into Web Development Meet Spark

This build.gradle file works.

I am using intelliJ. I added an extra line to dependencies and it worked. Here is my build.gradle file:

plugins {
    id 'java'
}

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

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.sparkjava:spark-core:2.9.3'
    compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.29'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
}

test {
    useJUnitPlatform()
}

1 Answer

You might want to replace compile with implementation:

dependencies {
    implementation 'com.sparkjava:spark-core:2.9.3'
    implementation group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.29'
    ...
}

compile was deprecated in one of the newer versions of gradle.