ant脚本在编译.jrxml
到.jasper
文件时抛出错误,仅针对使用JasperReports内置函数的文件。请帮我解决这个问题。
JasperReports版本是5.5.2。我已经用
更新了jasperreports_extension.properties
net.sf.jasperreports.extension.registry.factory.functions=net.sf.jasperreports.functions.FunctionsRegistryFactory
net.sf.jasperreports.extension.functions.datetime=net.sf.jasperreports.functions.standard.DateTimeFunctions
net.sf.jasperreports.extension.functions.math=net.sf.jasperreports.functions.standard.MathFunctions, net.sf.jasperreports.functions.standard.LogicalFunctions
net.sf.jasperreports.extension.functions.text=net.sf.jasperreports.functions.standard.TextFunctions
ant构建脚本中的错误跟踪:
[jrc] File : C:ProjectsJasperReportsrcmainreportFlower.jrxml ... FAILED.
[jrc] Error compiling report design : C:ProjectsDUJasperReportsrcmainreportFlower.jrxml
[jrc] net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
[jrc] 1. The method DATEFORMAT(Date, String) is undefined for the type Flower_1400575815940_409825
[jrc] value = DATEFORMAT(new Date(((java.sql.Timestamp)field_TIMESHEETDATE.getValue()).getTime()),"MMMM"); //$JR_EXPR_ID=15$
[jrc] <-------->
[jrc] 2. The method DATEFORMAT(Date, String) is undefined for the type Flower_1400575815940_409825
[jrc] value = DATEFORMAT(new Date(((java.sql.Timestamp)field_TIMESHEETDATE.getOldValue()).getTime()),"MMMM"); //$JR_EXPR_ID=15$
[jrc] <-------->
[jrc] 3. The method DATEFORMAT(Date, String) is undefined for the type Flower_1400575815940_409825
[jrc] value = DATEFORMAT(new Date(((java.sql.Timestamp)field_TIMESHEETDATE.getValue()).getTime()),"MMMM"); //$JR_EXPR_ID=15$
[jrc] <-------->
[jrc] 3 errors
[jrc] at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:204)
[jrc] at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:354)
[jrc] at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:270)
[jrc] at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:252)
[jrc] at net.sf.jasperreports.ant.JRAntCompileTask.compile(JRAntCompileTask.java:402)
[jrc] at net.sf.jasperreports.ant.JRAntCompileTask.execute(JRAntCompileTask.java:249)
[jrc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[jrc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[jrc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[jrc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[jrc] at java.lang.reflect.Method.invoke(Method.java:597)
[jrc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[jrc] at org.apache.tools.ant.Task.perform(Task.java:348)
[jrc] at org.apache.tools.ant.Target.execute(Target.java:392)
[jrc] at org.apache.tools.ant.Target.performTasks(Target.java:413)
[jrc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[jrc] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[jrc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[jrc] at org.eclipse.ant.internal.launching.remote.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[jrc] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[jrc] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.run(InternalAntRunner.java:424)
[jrc] at org.eclipse.ant.internal.launching.remote.InternalAntRunner.main(InternalAntRunner.java:138)
jasperreport 5.5.3项目构建没有在dist目录下生成jasper-functions-5.5.2.jar。我们需要使用joda-time jar作为依赖项手动下载jasper-functions jar。