0

I am using Jetty in my java project. I am using gradle to build and OpenJDK 1.8.

Recently my build broke, and I determined that if I rolled back the Jetty version is was fixed. It seems like the new version of Jetty jar was built with a different version of Java (I am just guessing here).

Here is my build.gradle...

apply plugin: 'java'

// Use maven repository
repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.eclipse.jetty:jetty-servlet:+'
    implementation 'org.eclipse.jetty:jetty-client:+'
}

Here is the build error...

/home/me/src/Chess/src/main/java/Client.java:1: error: cannot access HttpClient import org.eclipse.jetty.client.HttpClient; ^ bad class file: /home/me/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-client/10.0.0-alpha0/81ce90a421540f2c7e4e3026702dde608fc95c83/jetty-client-10.0.0-alpha0.jar(org/eclipse/jetty/client/HttpClient.class) class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath.

When I changed my gradle.build to use the previous version of Jetty, the build compiles properly...

dependencies {
    implementation 'org.eclipse.jetty:jetty-servlet:9.4.18.v20190429'
    implementation 'org.eclipse.jetty:jetty-client:9.4.18.v20190429'
}

How can I use the latest version of Jetty without my build breaking? Do I have to upgrade my Java version? That doesn't seem like a good solution...

Scorb
  • 1,654
  • 13
  • 70
  • 144

1 Answers1

2

Jetty 10 is the unstable, in-development version. It's not ready for general use. When it is ready, it will indeed require a newer version of Java and probably newer versions of other supporting software. That's typical for major version jumps.

The latest stable version of Jetty suitable for general use, according to https://www.eclipse.org/jetty/download.html, is 9.4.19.v20190610. That's what you should be using. It will be happy with OpenJDK 1.8, just like 9.4.18.

ottomeister
  • 5,415
  • 2
  • 23
  • 27