gradle: fork jvm when calling ant target

Viewed 111

I've got a gradle build running with JDK 11. Now I need to call an ant target with JDK8 (since the used versions are not JDK11 compatible). How do I fork the ant task execution?

Current gradle task implementation follows

task compileJasperReports {
    doLast {
        def jasperSourceDir = file('src/main/jasperreports')
        ant {
            taskdef(name: 'jrc',
                classname: 'net.sf.jasperreports.ant.JRAntCompileTask',
                classpath: configurations.jasperreports.asPath
            )
            sourceSets.main.java.outputDir.mkdirs()
            jrc(srcdir: jasperSourceDir, destdir: sourceSets.main.java.outputDir) {
                classpath(path: configurations.compile.asPath)
                include(name: '**/*.jrxml')
            }
        }
    }
}

Using a newer JasperReports Version is not an option (yet). Right now we're stuck with 4.5.1.

I did not find an option to fork ant and to specify a different JDK/JRE for the forked vm. Help would be appreciated.

0 Answers
Related