shading failure on JDK 24
Affected version
3.6.0
Bug description
On JDK 24 with minimizeJar=true shading errors with:
Error creating shaded jar: Unsupported class file major version 68
Bumping ASM dependency to 9.8 does not fix the problem. Please release a new version which support JDK24 and JDK25.
Creating a small reproducer would be appreciated.
stacktrace I can see
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 68
at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init> (ClassReader.java:200)
at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init> (ClassReader.java:180)
at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init> (ClassReader.java:166)
at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init> (ClassReader.java:288)
at org.vafer.jdependency.Clazzpath.addClazzpathUnit (Clazzpath.java:179)
at org.vafer.jdependency.Clazzpath.addClazzpathUnit (Clazzpath.java:151)
at org.apache.maven.plugins.shade.filter.MinijarFilter.<init> (MinijarFilter.java:104)
We only to use the new release org.vafer:jdependency:2.13
done via https://github.com/apache/maven-shade-plugin/pull/749 haha so groovy has his shaded asm, jdependency has his shaded asm. someone else? :)
arghh right org.vafer:jdependency:2.13 is jdk 11 minimum :(
@jakub-id you can still upgrade the version in your pom in the plugin > dependencies section.
I attempted to work around this in 3.6.0 by forcing the jdependency:2.13 dependency, but that alone was not enough, the update to asm:9.8 was also needed. Only with both forced dependencies I was able to compile with 24. asm-commons:9.8 isn't needed, but it'd probably be a bad idea to have a mismatch there.
I attempted to work around this in
3.6.0by forcing thejdependency:2.13dependency, but that alone was not enough, the update toasm:9.8was also needed. Only with both forced dependencies I was able to compile with 24.asm-commons:9.8isn't needed, but it'd probably be a bad idea to have a mismatch there.
yes both are needed. asm in the plugin itself is already done via https://github.com/apache/maven-shade-plugin/pull/744 but this one we cannot really upgrade except making the plugin jdk11 required. Personnally I would not mind but this might generate some discussions
You folks ping me if there is something I can do, right?
jdependency:2.14 is out for a while now.
And ASM usage in jdependency is shaded so it should be completely separate from the visitor in the shade plugin itself.
Just saying.
I can confirm that updating the jdependency to 2.14 fixes the same issue with Java 25 in my builds.
done via #749 haha so groovy has his shaded asm, jdependency has his shaded asm. someone else? :)
As long as they are minimized - no real harm done :)
I still have this in my inbox.
Nothing I can help with I guess? Just waiting for a new release of the maven-shade-plugin? What's blocking that?
done via #749 haha so groovy has his shaded asm, jdependency has his shaded asm. someone else? :)
As long as they are minimized - no real harm done :)
Yup that's not the problem :) The problem is already explained here in this comment https://github.com/apache/maven-shade-plugin/issues/747#issuecomment-3272308553
Most important part regarding jdependency
but this one we cannot really upgrade except making the plugin jdk11 required. Personnally I would not mind but this might generate some discussions
So the solution currently should be as simple as this below:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.vafer</groupId>
<artifactId>jdependency</artifactId>
<version>2.14</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
Well, one other option would be to re-add jdk11 support to jdependency.
Cannot say I am not eager given that jdk11 is EOL for almost 3y now.
But it could be an option.
But TBH. If people with that "extended commercial support/EOL" complain, we can offer them to pay for the additional work :)
But TBH. If people with that "extended commercial support/EOL" complain, we can offer them to pay for the additional work :)
correct :) and btw there is easy documented workaround. I agree on jdk upgrade but this is some long debates to have on mailing list :)
Fixed thanks to @tcurdt as 7edce171e15fccee898a69d264bdfdbe21229952