TIBCOSoftware / jasperreports

JasperReports® - Free Java Reporting Library
https://community.jaspersoft.com/downloads/community-edition/
GNU Lesser General Public License v3.0
1.06k stars 403 forks source link

Version 7.0.0 Samples for updating/compiling reports "antupdate" #450

Closed C4J closed 4 months ago

C4J commented 4 months ago

Now I'm maybe misinterpreting the process. It was my impression that I could bulk update my "pre version 7." reports via the command line. However when I copy one of my unaltered reports into the sample folder and run "ant test" I get an error like this one.

  [mkdir] Created dir: /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build/reports
      [jru] Updating 4 report design files.
      [jru] File : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/BarReport.jrxml ... OK.
      [jru] File : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/audit_permissions.jrxml ... FAILED.
      [jru] Error updating report design : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/audit_permissions.jrxml
      [jru] net.sf.jasperreports.engine.JRException: Unable to load report
      [jru]     at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:172)
      [jru]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:149)
      [jru]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:120)
      [jru]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:98)
      [jru]     at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:89)
      [jru]     at net.sf.jasperreports.ant.JRAntUpdateTask.update(JRAntUpdateTask.java:339)
      [jru]     at net.sf.jasperreports.ant.JRAntUpdateTask.execute(JRAntUpdateTask.java:204)
      [jru]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
      [jru]     at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      [jru]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [jru]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      [jru]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
      [jru]     at org.apache.tools.ant.Task.perform(Task.java:350)
      [jru]     at org.apache.tools.ant.Target.execute(Target.java:449)
      [jru]     at org.apache.tools.ant.Target.performTasks(Target.java:470)
      [jru]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
      [jru]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
      [jru]     at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
      [jru]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
      [jru]     at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:106)
      [jru]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
      [jru]     at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      [jru]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [jru]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
      [jru]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
      [jru]     at org.apache.tools.ant.Task.perform(Task.java:350)
      [jru]     at org.apache.tools.ant.Target.execute(Target.java:449)
      [jru]     at org.apache.tools.ant.Target.performTasks(Target.java:470)
      [jru]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
      [jru]     at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
      [jru]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      [jru]     at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
      [jru]     at org.apache.tools.ant.Main.runBuild(Main.java:818)
      [jru]     at org.apache.tools.ant.Main.startAnt(Main.java:223)
      [jru]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
      [jru]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)

However if I load a report into JasperSoft Studio 7 it appears to be happy with it and will let me compile.

Only if I save the report manually within JS and then use the antupdate script on the newly saved report does it appear to run.

I can supply a report sample if that helps.

Dave

C4J commented 4 months ago

Ok - so I have manually loaded and saved all of my reports in JasperSoft Studio 7 and manually recompiled them. They all seem to run but the antupdate routine seems unhappy with one particular report which has a Barcode4j barcode within it.

I get this output.

ant test
Buildfile: /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build.xml

test:
     [echo] ===================================
     [echo]  Ant Update Sample
     [echo] ===================================

clean:
   [delete] Deleting directory /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build

prepare-sample-classpath:
[ivy:configure] :: Apache Ivy 2.5.2 - 20230817170011 :: https://ant.apache.org/ivy/ ::
[ivy:configure] :: loading settings :: file = /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/ivysettings.xml

javac:
    [mkdir] Created dir: /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build/classes
    [javac] Compiling 4 source files to /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build/classes

prepare-sample-classpath:
[ivy:configure] :: loading settings :: file = /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/ivysettings.xml

define-jru:

update1:
    [mkdir] Created dir: /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build/reports
      [jru] Updating 133 report design files.
      [jru] File : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/fhf_despatch_detail_unconfirmed.jrxml ... OK.
      [jru] File : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/waste_transactions.jrxml ... OK.
File : /Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/reports/com/bar/waste_location_barcode.jrxml ... 

BUILD FAILED
/Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build.xml:111: The following error occurred while executing this line:
/Users/dave/Downloads/jasperreports-7.0.0/demo/samples/antupdate/build.xml:27: net.sf.jasperreports.jackson.util.JacksonRuntimeException: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'barcode4j:EAN128' as a subtype of `net.sf.jasperreports.engine.component.Component`: known type ids = [iconLabel] (for POJO property 'component')
 at [Source: (ByteArrayInputStream); line: 46, column: 5] (through reference chain: net.sf.jasperreports.engine.design.JasperDesign["detail"]->net.sf.jasperreports.engine.design.JRDesignSection["band"]->java.util.ArrayList[0]->net.sf.jasperreports.engine.design.JRDesignBand["element"]->java.util.ArrayList[1]->net.sf.jasperreports.engine.design.JRDesignComponentElement["component"])
    at net.sf.jasperreports.jackson.util.JacksonUtil.loadXml(JacksonUtil.java:309)
    at net.sf.jasperreports.engine.xml.JacksonReportLoader.loadReport(JacksonReportLoader.java:66)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:165)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:149)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:120)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:98)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:89)
    at net.sf.jasperreports.ant.JRAntUpdateTask.update(JRAntUpdateTask.java:339)
    at net.sf.jasperreports.ant.JRAntUpdateTask.execute(JRAntUpdateTask.java:204)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
    at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.Target.execute(Target.java:449)
    at org.apache.tools.ant.Target.performTasks(Target.java:470)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
    at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:106)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
    at jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
    at org.apache.tools.ant.Task.perform(Task.java:350)
    at org.apache.tools.ant.Target.execute(Target.java:449)
    at org.apache.tools.ant.Target.performTasks(Target.java:470)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
    at org.apache.tools.ant.Main.runBuild(Main.java:818)
    at org.apache.tools.ant.Main.startAnt(Main.java:223)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
Caused by: com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'barcode4j:EAN128' as a subtype of `net.sf.jasperreports.engine.component.Component`: known type ids = [iconLabel] (for POJO property 'component')
 at [Source: (ByteArrayInputStream); line: 46, column: 5] (through reference chain: net.sf.jasperreports.engine.design.JasperDesign["detail"]->net.sf.jasperreports.engine.design.JRDesignSection["band"]->java.util.ArrayList[0]->net.sf.jasperreports.engine.design.JRDesignBand["element"]->java.util.ArrayList[1]->net.sf.jasperreports.engine.design.JRDesignComponentElement["component"])
    at com.fasterxml.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:43)
    at com.fasterxml.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:2040)
    at com.fasterxml.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1590)
    at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._handleUnknownTypeId(TypeDeserializerBase.java:298)
    at com.fasterxml.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:165)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:151)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)
    at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:138)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:215)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:187)
    at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:170)
    at com.fasterxml.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:136)
    at com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:263)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:363)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:246)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
    at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:361)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:246)
    at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30)
    at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:273)
    at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:131)
    at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserializeWith(SettableBeanProperty.java:579)
    at com.fasterxml.jackson.databind.deser.impl.MergingSettableBeanProperty.deserializeAndSet(MergingSettableBeanProperty.java:80)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:310)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
    at com.fasterxml.jackson.dataformat.xml.deser.WrapperHandlingDeserializer.deserialize(WrapperHandlingDeserializer.java:122)
    at com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext.readRootValue(XmlDeserializationContext.java:104)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4905)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3885)
    at net.sf.jasperreports.jackson.util.JacksonUtil.loadXml(JacksonUtil.java:305)
    ... 37 more

Total time: 1 second
dadza commented 4 months ago

Do you have jasperreports-barcode4j-7.0.0.jar on your project's classpath?

C4J commented 4 months ago

I am using the unmodified build.xml from your antupdate example. I just copied my reports into the same folder as the demo reports.

C4J commented 4 months ago

I've added some jars to the build.xml class path and now all my reports compile.

Thanks for the tip

Dave