lumidion / sonatype-central-client

A client for calling the Sonatype Central publishing api
MIT License
2 stars 1 forks source link

Sttp client failing with Java 8 #11

Open Andrapyre opened 4 days ago

Andrapyre commented 4 days ago

Description

When the sttp client runs with Java 8, it produces the following error in Github Actions on all Scala versions:

java.lang.UnsupportedClassVersionError: sttp/client4/httpurlconnection/HttpURLConnectionBackend$ has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

First raised in https://github.com/xerial/sbt-sonatype/issues/548

Andrapyre commented 3 days ago

Refactoring to change to an OkHttp backend produces the following:

com.lumidion.sonatype.central.client.integration.test.SyncSttpItSpec *** ABORTED ***
[info]   java.lang.NoClassDefFoundError: java/net/http/HttpTimeoutException
[info]   at sttp.client4.okhttp.OkHttpBackend.adjustExceptions(OkHttpBackend.scala:49)
[info]   at sttp.client4.okhttp.OkHttpBackend.send(OkHttpBackend.scala:38)
[info]   at sttp.client4.wrappers.FollowRedirectsBackend.sendWithCounter(FollowRedirectsBackend.scala:19)
[info]   at sttp.client4.wrappers.FollowRedirectsBackend.send(FollowRedirectsBackend.scala:15)
[info]   at sttp.client4.Request.send(request.scala:159)
[info]   at com.lumidion.sonatype.central.client.sttp.core.SyncSonatypeClient.uploadBundle(SyncSonatypeClient.scala:27)
[info]   at com.lumidion.sonatype.central.client.integration.test.SyncSttpItSpec.$anonfun$new$7(SyncSttpItSpec.scala:42)
[info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
[info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
[info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
[info]   ...
[info]   Cause: java.lang.ClassNotFoundException: java.net.http.HttpTimeoutException
[info]   at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
[info]   at sbt.internal.ManagedClassLoader.findClass(ManagedClassLoader.java:103)
[info]   at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
[info]   at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
[info]   at sttp.client4.okhttp.OkHttpBackend.adjustExceptions(OkHttpBackend.scala:49)
[info]   at sttp.client4.okhttp.OkHttpBackend.send(OkHttpBackend.scala:38)
[info]   at sttp.client4.wrappers.FollowRedirectsBackend.sendWithCounter(FollowRedirectsBackend.scala:19)
[info]   at sttp.client4.wrappers.FollowRedirectsBackend.send(FollowRedirectsBackend.scala:15)
[info]   at sttp.client4.Request.send(request.scala:159)
[info]   at com.lumidion.sonatype.central.client.sttp.core.SyncSonatypeClient.uploadBundle(SyncSonatypeClient.scala:27)