-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
relocate not working: Unsupported class file major version 63 #877
Comments
Use Shadow 8, the older versions don't support newer JDK. |
I'm having the same issue, adding This project is running on Java 11 (like @cnglen), cannot find any indication that Java 19(63) is being used. @cnglen were you able to successfully fix this by using Shadow 8? Upgrading to Grade-8 is going to take a bit of work in my project and would like to avoid it if it didn't fix for you. Gradle 7.4Build time: 2022-02-08 09:58:38 UTC Kotlin: 1.5.31 |
Hey, i have the same issue when using |
Hi, did anyone managed to find a workaround for this issue? A lot of newer library versions are 'multi release' versions, aka including in META-INF/versions java classes compiled for multiple JDK's, see https://openjdk.org/jeps/238 |
I tried compiling it with JDK8, but it also produced the |
I too am running into the same issue when I use a relocate in the shadow plugin, anyone found out a workaround to get over this issue?
|
The problem went away when using "com.github.johnrengelman.shadow" version "8.1.1" instead of version 7 |
The problem is still present with 8.1.1 version on my end. |
Yes I think the problem is still present and as @cornelcreanga points out more and more libraries are using the multi-release style jar files https://openjdk.org/jeps/238. So if you are running a lesser JDK such as JDK17 and you happen to use one of these multi-release style jars that has class files for JDK17 and JDK19 you see this exception for the JDK19 class files:
The JVM and I presume ASM simply doesn't know what do with a higher version class file. Does the filter / exclusion logic in the Shadow jar work before ASM kicks in? Seems like it doesn't given what we are hearing from reports. I ran into this issue myself with the latest jackson-core library and filed an issue there originally: |
Shadow 8.1.1 works well on Gradle 8 and Java 19, check Goooler/StringResExporter#29. @rmatec If it does not work for you, please provide me with a minimum reproducer. |
I added the following exclusions to avoid the incompatible classes being shadowed exclude 'META-INF/versions/17/' and worked for me. My 2cts. |
Please check the User Guide before submitting "how do I do 'x'?" questions!
Shadow Version
Gradle Version
gradle -version
Gradle 7.6
Build time: 2022-11-25 13:35:10 UTC
Revision: daece9dbc5b79370cc8e4fd6fe4b2cd400e150a8
Kotlin: 1.7.10
Groovy: 3.0.13
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.18 (Amazon.com Inc. 11.0.18+10-LTS)
OS: Mac OS X 12.4 x86_64
Expected Behavior
Actual Behavior
Gradle Build Script(s)
Content of Shadow JAR (
jar tf <jar file>
- post link to GIST if too long)gradle build
FAILURE: Build failed with an exception.
Execution failed for task ':shadowJar'.
The text was updated successfully, but these errors were encountered: