Wednesday, 3 October 2018

Reminder: SparkJava 2.7.2 pom.xml known to work for new projects

Problem

For SparkJava 2.7.2, I'd like a known set of POM.xml dependencies and properties that work so I can kick-start my project. The settings in the SparkJava "getting started" tutorial result in exceptions.

Example POM.xml snippet

In your POM.xml, try these to start off:

    <properties>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
  
  
    <dependencies>
  
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>9.4.6.v20170531</version>
        </dependency>
  
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.21</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.21</version>
        </dependency>
 
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.7.2</version>
        </dependency>
    </dependencies>

Notes

The above dependency versions and properties were observed to work on 2018-10-03 with SparkJava version 2.7.2. Your mileage may vary.

Once you have your SparkJava project working, feel free to change versions to suit your own project needs.

References