Why do I get compilation error “org/codehaus/groovy/control/CompilationFailedException”?

独自空忆成欢 提交于 2019-12-28 01:53:36

问题


I am trying to compile my JasperReports template using an Ant script and Java. I am getting this error:

jasper java.lang.NoClassDefFoundError:
org/codehaus/groovy/control/CompilationFailedException

There is nothing complex in the template, but I still can't compile.


回答1:


You will have to set the language value in your template to Java. There are two ways you can do this:

  1. If you are using iReport, select the root object in your Report Inspector (the one with the same name as your report). Then in the Properties window, select Java from the Languages drop-down.

  2. If you are editing the raw mark-up in the JRXML file, remove language="groovy" from the file altogether.

Then try to recompile - you should be sorted. :)




回答2:


Another solution is to copy groovy-all-{version}.jar from the groovy binary distribution into the application's.




回答3:


If you are using TIBCOJaspersoftStudio:

  1. Download latest groovy 2.4.* jar from http://groovy-lang.org/download.html
  2. Unpack and get this file ./groovy-2.4.10/embeddable/groovy-all-2.4.10.jar
  3. Put the jar in ./TIBCOJaspersoftStudio-6.3.1.final/plugins
  4. Delete the old jar: ./TIBCOJaspersoftStudio-6.3.1.final/plugins/groovy-all_2.4.5.jar



回答4:


Change the languge to java in JRXML (ex:- language="java") or add groovy*.jar to your project’s classpath.




回答5:


If you are using Maven, you must add the groovy dependency in your pom.xml.

<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy-all</artifactId>
    <version>2.4.10</version>
</dependency>

In another case, you must add the library groovy in your lib folder (WEB-INF/lib)



来源:https://stackoverflow.com/questions/8935925/why-do-i-get-compilation-error-org-codehaus-groovy-control-compilationfailedexc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!