I may be missing something silly here, but it looks like dependencies in the compile classpath are not used to execute the JasperCompileManager
.
We are using some joda time classes in our reports, joda time is in the compile classpath, but we get the following sorts of errors:
[InvoiceDepartment.jrxml] Errors were encountered when compiling report expressions class file:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
General error during class generation: java.lang.NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
java.lang.RuntimeException: java.lang.NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
at org.codehaus.groovy.control.CompilationUnit.convertUncaughtExceptionToCompilationError(CompilationUnit.java:1083)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1061)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:583)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:561)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:538)
at net.sf.jasperreports.compilers.JRGroovyCompiler.compileUnits(JRGroovyCompiler.java:109)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:241)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:157)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:139)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:438)
at net.sf.jasperreports.engine.JasperCompileManager$compileReportToFile$3.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at com.github.gmazelier.tasks.JasperReportsCompile$_execute_closure4_closure7.doCall(JasperReportsCompile.groovy:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:278)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
at groovy.lang.Closure.call(Closure.java:423)
at groovy.lang.Closure.call(Closure.java:439)
at groovyx.gpars.pa.CallClosure.call(CallClosure.java:47)
at groovyx.gpars.pa.ClosureMapper.op(ClosureMapper.java:36)
at groovyx.gpars.extra166y.AbstractParallelAnyArray$OOMPap.leafTransfer(AbstractParallelAnyArray.java:2255)
at groovyx.gpars.extra166y.PAS$FJOMap.atLeaf(PAS.java:258)
at groovyx.gpars.extra166y.PAS$FJBase.internalCompute(PAS.java:118)
at groovyx.gpars.extra166y.PAS$FJBase.compute(PAS.java:106)
at jsr166y.RecursiveAction.exec(RecursiveAction.java:148)
at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:305)
at jsr166y.ForkJoinWorkerThread.execTask(ForkJoinWorkerThread.java:575)
at jsr166y.ForkJoinPool.scan(ForkJoinPool.java:733)
at jsr166y.ForkJoinPool.work(ForkJoinPool.java:617)
at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:369)
Caused by: java.lang.NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
at net.sf.jasperreports.compilers.JRGroovyCompiler$ClassCollector.call(JRGroovyCompiler.java:160)
at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:814)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1047)
... 36 more
1 error
[InvoiceTitle.jrxml] Errors were encountered when compiling report expressions class file:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
calculator_InvoiceTitle_1421861925896_293545: 168: unable to resolve class org.joda.time.LocalDate
@ line 168, column 22.
calculator_InvoiceTitle_1421861925896_293545: 232: unable to resolve class org.joda.time.LocalDate
@ line 232, column 22.
calculator_InvoiceTitle_1421861925896_293545: 296: unable to resolve class org.joda.time.LocalDate
@ line 296, column 22.
3 errors
Is this a known issue? I was able to work around it for now by adding the joda time dependency to the buildscript classpath: