ADempiere/Jasper Batch Compile

From ADempiere
Revision as of 08:06, 4 June 2009 by Openk-hd (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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. This might be helpful if you are using lots of Jasper-Templates and do not want do compile them one by one from iReport. Hope this helps some of you save a little time!

Add two new targets to your build.xml:


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

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 Jarfiles: commons-beanutils.jar commons-collections.jar commons-digester.jar commons-logging.jar jasperreports.jar

The versions from within 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 one mouse click away.