由于ant中内置缺失,jrxml文件编译失败

时间:2014-05-20 09:38:22

标签: ant jasper-reports

在编译.jrxml.jasper文件时,ant脚本会抛出错误,仅针对使用 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 build脚本中的错误跟踪:

 [jrc] File : C:\Projects\JasperReport\src\main\report\Flower.jrxml ... FAILED.
      [jrc] Error compiling report design : C:\Projects\DU\JasperReport\src\main\report\Flower.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)

1 个答案:

答案 0 :(得分:1)

jasperreport 5.5.3项目构建不会在dist目录下生成jasper-functions-5.5.2.jar。我们需要手动下载jasper-jar jar作为依赖项。

相关问题