ADempiere/Jasper Batch Compile

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

Here's a little hint how to speed up the compilation of .jrmxl-Files within eclipse or netbeans. This might be helpful if you are using lots of Jasper-Templates and do not want do compile them one by one from iReport - well, in our case 29 templates were quite enough... Hope this helps some of you save a little time!

Add two new ant targets to your build.xml:

   <target name="delete-jasper-files">
       <property name="jasper.dir" value="${src}"/>
           <fileset dir="${jasper.dir}" includes="**/*.jasper"/>
       <echo level="info" message="Existing Jasper-Files deleted."/>
   <target name="compile-jasper-templates" depends="init">
       <path id="jrc.classpath">
           <pathelement path="${build.classes.dir}"/>
           <fileset dir="./lib" includes="*.jar"/>
       <property name="jasper.dir" value="${src}"/>
           <fileset dir="${jasper.dir}" includes="**/*.bak"/>
       <echo level="info" message="Existing Jasper-Backup-Files deleted."/>
       <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">
           <classpath refid="jrc.classpath"/>
       <jrc srcdir="${jasper.dir}"
           <classpath refid="jrc.classpath"/>
           <include name="**/*.jrxml"/>
       <copy todir="${build.classes.dir}">
           <fileset dir="${src}"/>
       <echo level="info" message="Compilation of jasper-Templates completed."/>

The first target deletes all .jasper files - you might add this target to your project's "clean" target. The second target compiles all .jrxml files and deletes any existing .bak files.

You might have to adjust some of the parameters, but this should be pretty much self-explaining...

Then, make sure your project's classpath contains the following jar files:

  • commons-beanutils.jar
  • commons-collections.jar
  • commons-digester.jar
  • commons-logging.jar
  • jasperreports.jar

The versions from the ADempiere project should work fine, I think - however, we're currently trying jasperreports-3.5.1.jar ;-)

Now, compilation of one or fifty or five hundred Jasper templates is just a few mouse clicks away.