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 trialLee Haney
395 PointsThis pom.xml file works for this Spark project
I am using Visual Studio Code and Maven build tool for this project. I went to the Java Spark documentation at http://sparkjava.com/tutorials/maven-setup and copied their example of a pom.xml file into my own. After that, I added the slf4j dependency. Below is the pom.xml file that worked for me:
<project>
<!-- model version - always 4.0.0 for Maven 2.x POMs -->
<modelVersion>4.0.0</modelVersion>
<!-- project coordinates - values which uniquely identify this project -->
<groupId>com.teamtreehouse.courses</groupId>
<artifactId>course-ideas</artifactId>
<version>1.0</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<!-- library dependencies -->
<dependencies>
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
</project>
If you see this error message: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation. SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
It means you need to include an slf4j logging implementation in your maven dependencies For example, add the following to your pom.xml dependencies:
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.30</version>
</dependency>