Closed dougborg closed 9 years ago
Actually, it seems there are 2 issues there. The joda-time one I was indeed able to work around, but the NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
is still giving me trouble.
OK I got past the NoClassDefFoundError
by adding localGroovy()
to the classpath, but now I am getting:
:compileJava UP-TO-DATE
:prepareReportsCompilation
>>> JasperReports Plugin Configuration
Source directory: /Users/douglas.borg/ReadyTalk/bbs-engine/src/main/reports
Temporary directory: /Users/douglas.borg/ReadyTalk/bbs-engine/build/jasperreports
Output directory: /Users/douglas.borg/ReadyTalk/bbs-engine/build/classes/main
Source files extension: .jrxml
Compiled files extension: .jasper
Compiler: net.sf.jasperreports.engine.design.JRJdtCompiler
Keep Java files: false
Validate XML before compiling: true
<<<
:compileAllReports
Compiling file AccountSummarySub.jrxml
Compiling file InvoiceContactDetailAudioSub.jrxml
Compiling file InvoiceAccessCodeSummary.jrxml
Compiling file InvoiceContactDetail.jrxml
Compiling file AccountNewChargesSummarySub.jrxml
Compiling file InvoiceDepartment.jrxml
Compiling file InvoiceTitle.jrxml
Compiling file InvoiceContactDetailWebSub.jrxml
Compiling file InvoiceAccessCodeDetail.jrxml
Compiling file InvoiceAccount.jrxml
:compileAllReports FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileAllReports'.
> java.lang.LinkageError (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':compileAllReports'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:56)
Caused by: java.lang.LinkageError
at jsr166y.ForkJoinTask.getThrowableException(ForkJoinTask.java:507)
at jsr166y.ForkJoinTask.reportResult(ForkJoinTask.java:567)
at jsr166y.ForkJoinTask.join(ForkJoinTask.java:611)
at jsr166y.ForkJoinPool.invoke(ForkJoinPool.java:1492)
at groovyx.gpars.extra166y.AbstractParallelAnyArray.allObjects(AbstractParallelAnyArray.java:306)
at groovyx.gpars.extra166y.ParallelArrayWithMapping.all(ParallelArrayWithMapping.java:141)
at groovyx.gpars.GParsPoolUtil.collectParallel(GParsPoolUtil.java:495)
at com.github.gmazelier.tasks.JasperReportsCompile$_execute_closure4.doCall(JasperReportsCompile.groovy:41)
at groovyx.gpars.GParsPool$_withExistingPool_closure1.doCall(GParsPool.groovy:174)
at groovyx.gpars.GParsPool$_withExistingPool_closure1.doCall(GParsPool.groovy)
at groovyx.gpars.GParsPool.withExistingPool(GParsPool.groovy:173)
at groovyx.gpars.GParsPool$withExistingPool$2.callStatic(Unknown Source)
at groovyx.gpars.GParsPool.withPool(GParsPool.groovy:145)
at groovyx.gpars.GParsPool$withPool$1.callStatic(Unknown Source)
at groovyx.gpars.GParsPool.withPool(GParsPool.groovy:121)
at groovyx.gpars.GParsPool$withPool$0.callStatic(Unknown Source)
at groovyx.gpars.GParsPool.withPool(GParsPool.groovy:100)
at groovyx.gpars.GParsPool$withPool.callStatic(Unknown Source)
at com.github.gmazelier.tasks.JasperReportsCompile.execute(JasperReportsCompile.groovy:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:235)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:222)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more
Caused by: java.lang.LinkageError: groovyjarjarasm/asm/ClassWriter
at net.sf.jasperreports.compilers.JRGroovyCompiler$ClassCollector.call(JRGroovyCompiler.java:160)
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 com.github.gmazelier.tasks.JasperReportsCompile$_execute_closure4_closure7.doCall(JasperReportsCompile.groovy:46)
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:755)
at jsr166y.ForkJoinPool.work(ForkJoinPool.java:617)
at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:369)
Hi,
Thanks for the report. I'm going to create a test project and try to reproduce your problem. Meanwhile, can you give me details about your environment? Java, Groovy and Gradle versions for example.
Gaylord
I've created a simple project for my tests, the most interesting files are available in this gist : https://gist.github.com/28df7263141f1a8919c7.git. The plugin has a new configuration parameter classpath
, the default behavior makes runtime classpath available for designs compilation.
Can you:
HEAD
gradle clean publishToMavenLocal
mavenLocal()
to your buildScript
dependenciesclasspath 'com.github.gmazelier:jasperreports-gradle-plugin:0.1-SNAPSHOT'
gradle clean compileAllReports
Please, let me know.
Sure thing:
------------------------------------------------------------
Gradle 2.2.1
------------------------------------------------------------
Build time: 2014-11-24 09:45:35 UTC
Build number: none
Revision: 6fcb59c06f43a4e6b1bcb401f7686a8601a1fb4a
Groovy: 2.3.6
Ant: Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM: 1.7.0_72 (Oracle Corporation 24.72-b04)
OS: Mac OS X 10.10.1 x86_64
The version of jasper is the same as what you have defined as the dependency in the plugin: 5.2.0. @sgoings and I have tried a few different things to get it to work:
So far, nothing has helped or got us a different error, but I am still working on testing number 3 above.
Regarding the LinkageError
error, are your localGroovy()
(shipped with Gradle) and your project Groovy versions the same? It's perhaps a dependency conflict.
I was thinking it might be a conflict like that as well, but this is a Java project and the only thing that seems to need the groovy jar is the jasper reports generation. This project does not apply the groovy plugin, just the 'java' plugin via the 'war' plugin.
I pulled down and installed the latest version of the plugin to my local maven and updated my project to use it as you suggested. I am still getting the missing class on the groovy ClassWriter if I do not add groovy to my buildscript classpath, but it is picking up jodatime just fine from the runtime classpath:
[InvoiceTitle.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$5.call(Unknown Source)
at com.github.gmazelier.tasks.JasperReportsCompile$_execute_closure5_closure8.doCall(JasperReportsCompile.groovy:61)
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.compute(PAS.java:108)
at jsr166y.RecursiveAction.exec(RecursiveAction.java:148)
at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:305)
at jsr166y.ForkJoinWorkerThread.helpJoinTask(ForkJoinWorkerThread.java:783)
at jsr166y.ForkJoinWorkerThread.joinTask(ForkJoinWorkerThread.java:698)
at jsr166y.ForkJoinTask.doJoin(ForkJoinTask.java:333)
at jsr166y.ForkJoinTask.join(ForkJoinTask.java:610)
at groovyx.gpars.extra166y.PAS$FJBase.internalCompute(PAS.java:120)
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)
... 40 more
1 error
The groovy jar is in the "Additional classpath" log message:
...
:compileAllReports
Additional classpath: [file:/Users/douglas.borg/ReadyTalk/bbs-engine/build/classes/main/, file:/Users/douglas.borg/ReadyTalk/bbs-engine/build/resources/main/, file:/Users/douglas.borg/.gradle/wrapper/dists/readytalk-gradlew-1.3.0-2.2.1-bin/e6masi0r8eub7tl74n3sbicm8/gradle-2.2.1/lib/groovy-all-2.3.6.jar,
...
No other groovy jars appear in that listing.
I have not yet been able to reproduce this on the example project. I have tried making it a java project instead. I'll play around with this a bit more and see what I can figure out.
if you can give me a project with non-sensitive code that reproduces the error, do not hesitate.
Thanks so much for your help! I have determined the error seems to be particular to the jasper files we are using for our reports. I do not know which part of the report definition is causing the java.lang.NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
error, and I have zero experience with the Jasper stuff - I am just working on getting this project switched over to gradle from maven.
I am pretty sure the report I put in to the example isn't sensitive, but just to be safe I created a private github repo to limit access. Check out: https://github.com/dougborg/jasperProblems
I think we are following the right track with the Groovy versions conflict. Looking at your project, I figured that your JRXML specifies groovy
as value for the language
attribute. The same file with java
value compiles. Your reports may require Groovy for the compilation, but this one works with this change.
Looking JasperReports dependencies, we can find groovy-all
2.0.1 in the list. The LinkageError
error is probably related to this. I'll see tomorrow if it's possible to exclude the Groovy dependency provided by JasperReports.
Good luck.
EDIT: about the groovy-all
dependency, I missed that it's declared as optional in JR POM.
Hi Doug,
I've updated your example project and the reports now compile. I've made two modifications:
buildscript
section. It's a better alternative to changing the classloarder as proposed in the patch with the classpath
parameter. I'll probably keep this change but the script configuration seems a cleaner approach.language
in report definition from groovy
to java
to prevent the LinkageError
or java.lang.NoClassDefFoundError: groovyjarjarasm/asm/ClassWriter
error if groovy-all
in not added in the buildscript
configuration. It's a known workaround, see this comment on SO for example.Not optimal, but it works.
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:
Is this a known issue? I was able to work around it for now by adding the joda time dependency to the buildscript classpath: