0
> ./gradlew --version
------------------------------------------------------------
Gradle 6.1.1
------------------------------------------------------------
Kotlin:       1.3.61
Groovy:       2.5.8
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          11.0.18

//inside build.gradle
dependencies {
...
classpath "com.github.jengelman.gradle.plugins:shadow:6.1.0"
...
}

According to the compatibility table here: https://github.com/johnrengelman/shadow, gradle 6.1.1 with shadow 6.1.0 and Java 11 should be compatible. However when I try to build using ./gradlew build shadowJar I get an error about:

2023-08-03T14:54:20.719-0700 [ERROR] [com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction] ex
java.lang.IllegalArgumentException: Unsupported class file major version 63

According to here, version 63 is Java 19. Both ./gradlew and java --version are telling me I'm using 11.0.18 so where does this error about major version 63 come from?

divide_by_zero
  • 997
  • 1
  • 8
  • 20
  • What about `javac --version`? – g00se Aug 03 '23 at 23:00
  • `javac --version` is 11.0.18, same as the others – divide_by_zero Aug 03 '23 at 23:14
  • Are any of the dependencies that you're trying to fat jar compiled with Java 19? – g00se Aug 03 '23 at 23:20
  • I'm not quite sure, the list of dependencies is quite large, how would I check that? Even if that was the case, shadow 6.1.0 says it should work with 8+ – divide_by_zero Aug 04 '23 at 02:37
  • Let me think. What OS are you using? – g00se Aug 04 '23 at 07:59
  • This is on macOS – divide_by_zero Aug 04 '23 at 19:21
  • My theory could be wrong but I knocked up an app to test jars for their class version. Shall post link in a minute or two. [Here we are](https://technojeeves.com/tech/util-1.0-SNAPSHOT.jar). Just point that at a directory or jar or class file. `java -jar util-1.0-SNAPSHOT.jar x.jar`. Is in any case interesting to know what versions you're dealing with – g00se Aug 04 '23 at 19:47
  • I think this is potentially a gradle issue, from the gradle 7.6.1 notes: `- Added support for Java 19.` – divide_by_zero Aug 04 '23 at 19:50
  • Well you said that there's nothing at 19 present, so it shouldn't *need* to support it – g00se Aug 04 '23 at 19:52
  • I was trying a few different combinations of dependency versions and one of my dependencies is solr. With solr 9.3 I'm getting these issues but it's working for solr 8.x. Unfortunately, I do specifically need solr 9.x. – divide_by_zero Aug 04 '23 at 20:03
  • 1
    If you point that app at the Solr directory it will find all the jars and tell you what version they've been compiled to – g00se Aug 04 '23 at 20:14
  • 1
    According to my app, Solr 9.3 is Java 11 – g00se Aug 04 '23 at 21:51

0 Answers0