DanielL Posted January 15, 2021 Share Posted January 15, 2021 Hello Community,First of all my Setup.GroovyVersion: 2.5.11JasperReports: 6.15.0alexnederlof-plugin (to compile .jrxml with maven) To make it short:We wanted to update our GroovyVersion to 3.0.7, because we got a WarningAfter a bit of search I found out, that this warning was handled since Groovy 3.0.0.We then got an Error on our alex-plugin, because it couldn't handle anything above Groovy 2.5.14.Failed to execute goal com.alexnederlof:jasperreports-plugin:2.8:jasper (default) on project server: Error while compiling Jasper reports: java.lang.IncompatibleClassChangeError: class net.sf.jasperreports.compilers.JRGroovyCompiler$ClassCollector has interface org.codehaus.groovy.control.CompilationUnit$ClassgenCallback as super class -> [Help 1][/code]So I decided to force it to use Version 2.5.14 <groupId>com.alexnederlof</groupId><artifactId>jasperreports-plugin</artifactId><version>2.8</version> <dependencies> <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all --> <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groovy-all</artifactId> <version>2.5.14</version> <type>pom</type> </dependency> </dependencies>[/code]Not a big deal, until a colleague of mine wrote some Testclasses.In those he compiled the .jrxml-files with java itself an now the big problem comes in place:Because we declare Groovy in our pom with verison 3.0.7, the JasperReport Dependency updates his initernalt Groovy dependency also to 3.0.7.But becaus of, Groovy updated an abstract class to an Interface, we now get the same error and maven buildfailure in our java code, because of those tests. Now we are not able to force jasperreports to use a different GroovyVersion and we don't want to use our own ClassLoader to use both VersionTherefore my big question to Jaspersoft:When can we get an updated Version of Jasperreports which is using a higher GroovyVersion (like 3.0.7)? I've encountered a lot of this problem on other sides and wonder why there isn't a fix to this, since it look like to be an issue for a while nowLooking forward to see a new update comingHave a nice day :) Link to comment Share on other sites More sharing options...
JohannesR Posted March 19, 2021 Share Posted March 19, 2021 Unfortunately i stumbled upon the same problem. Can't find a solution... Link to comment Share on other sites More sharing options...
edu-de Posted April 27, 2021 Share Posted April 27, 2021 Seems to be available in next release: https://github.com/TIBCOSoftware/jasperreports/issues/131 Link to comment Share on other sites More sharing options...
mandelbrain Posted May 10, 2021 Share Posted May 10, 2021 What I needed:1. an updated jasperreports-6.16.0.jar, which worked with groovy 32. to swap in groovy 3 and swap out groovy 2 in my dependenciesSolution:I downloaded the jasperreports-6.16.0 project.Opened it in Eclipse. (Must have Ant and Ivy installed)Modify exactly TWO lines of source code.First, in the ivy.xml file,Replace: <dependency org="org.codehaus.groovy" name="groovy-all" rev="2.4.16"/>With: <dependency org="org.codehaus.groovy" name="groovy" rev="3.0.8"/>This will cause the JasperReports source code file below to now be a compile time error.(In the ivy's lib dir, you may need to remove the old: groovy-all-2.4.16.jar)Second,Find file: package net.sf.jasperreports.compilers; public class JRGroovyCompilerThen find this: /** * */ private static class ClassCollector extends CompilationUnit.ClassgenCallback {At about line 157, in JasperReports 6.16.0.Change 'extends' to 'implements'. There is a third change I made so that when I build it, the JAR file will be named jasperreports-6.16.0-custom.jar.In build.xml <target name="jar" depends="compile" description="Builds the JasperReports JAR file."> <mkdir dir="./dist"/> Change the next line to have the word CUSTOM: <jar jarfile="./dist/jasperreports-${version}-custom.jar" manifest="build/classes/META-INF/MANIFEST.MF"> Now build the project. Refresh so the 'dist' directory appears. Look inside, find the new jarperreports-6.16.0-custom.jar file. I then put this JAR ingo my primary project, and upgraded groovy from 2 to 3. Problems solved.Hope that helps someone. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now