pro-crafting / Jasper-report-maven-plugin

A fast jasper report maven plugin
Apache License 2.0
26 stars 3 forks source link

UnsupportedClassVersionError #85

Open haraleib opened 4 months ago

haraleib commented 4 months ago

Hello, I am trying to update from to Jasper Reports 6.11.0 to 6.21.2 so it seems to be a good choice to also update jasperreports-plugin. So I am now taking it from your repo with Version 3.6.1.

I am getting the following exception when i build my project.

com.pro-crafting.tools:jasperreports-plugin:3.6.1:jasper (default) on project XXXX: Error while compiling Jasper reports: java.lang.UnsupportedClassVersionError: net/sf/dynamicreports/jasper/base/JasperSystemFontExtensionsRegistryFactory has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

Any idea how can i get fix this? My plugin configuration looks like the following image

Postremus commented 3 months ago

sorry for not getting back to you earlier.

It looks to me like net/sf/dynamicreports was compiled using java 17 without the --release 11 switch set. I never used dynamicreports however, and according to their website they seem to be still compatible with java 8 - which would also include java 11 compatibility.

Out of curiosity, how did you solve this in the end? Might be helpful for others with the same error.

haraleib commented 3 months ago

Thanks for your answer. I searched a little bit on the internet, where did you find the possibility to set a --release flag for dynamicreports. I have the impression, that it lacks a little bit for documentation, so I didnt found something according this. Maybe you can post a link or something like this :)

Postremus commented 3 months ago

With the --release 11 flag I meant the jdk compiler flag. https://openjdk.org/jeps/247

I was previously just looking at the dynamicreports website https://dynamicreports.org/, which did not point to any update of this library past 2018, and did not hint at maven coordinates. I assumed the library had to be therefore compiled manually, which lead me to believe that you might have used jdk 17 by mistake for the compilation. Sorry for this misunderstanding.

I dug a bit deeper and found their new github https://github.com/dynamicreports/dynamicreports. They updated to java 17 (from 1.8) with dynamicreports 6.20.1 in PR https://github.com/dynamicreports/dynamicreports/pull/132.

According to https://github.com/dynamicreports/dynamicreports/issues/124#issuecomment-1776870140 you might be able to use dynamicreports 6.20.0, which could be compatible with java 11. Can you please try this out? Not sure though if it is compatible with jasper 6.21.2.