JasperReports Groovy update to 3.x.x?

Hello Community,

First of all my Setup.

GroovyVersion: 2.5.11
JasperReports: 6.15.0
alexnederlof-plugin (to compile .jrxml with maven)


To make it short:
We wanted to update our GroovyVersion to 3.0.7, because we got a Warning
After 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]

So I decided to force it to use Version 2.5.14

    <!-- https://mvnrepository.com/artifact/org.codehaus.groovy/groovy-all -->

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 Version

Therefore 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 now

Looking forward to see a new update coming

Have a nice day :)

DanielL's picture
Joined: Jan 15 2021 - 1:28am
Last seen: 1 year 4 months ago

Unfortunately i stumbled upon the same problem. Can't find a solution...

JohannesR - 2 years 6 months ago

Seems to be available in next release: https://github.com/TIBCOSoftware/jasperreports/issues/131

edu-de - 2 years 5 months ago

What I needed:

1. an updated jasperreports-6.16.0.jar, which worked with groovy 3

2. to swap in groovy 3 and swap out groovy 2 in my dependencies


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,

        <dependency org="org.codehaus.groovy" name="groovy-all" rev="2.4.16"/>
        <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)


Find file:

    package net.sf.jasperreports.compilers;
    public class JRGroovyCompiler

Then 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.

mandelbrain - 2 years 4 months ago

0 Answers:

No answers yet