Jump to content

JRAntCompileTask produces different jasper files


dman

Recommended Posts

hi all,

in my application i use JRAntCompileTask to compile my report design files (jrxml).

the problem is, even if the design file does not change, repetitive execution of the JRAntCompileTask produces different jasper files. I used a diff utility to check what the difference is and found out that the name of the temporaray java file varies from compilation to compilation.

I set the flag "keepjava" to "false" but it only does not keep the java files, the java file name is still written into the jasper file.

Has anyone an idea how to change the ant task to get identical jasper files from identical jrxml files?

Thanks for any help in advance,

regards,
dman

 

Code:
<target name="compile.jrxml" description="Compiles the XML report designs and produces the .jasper files.">        <taskdef name="jrc" classname="net.sf.jasperreports.ant.JRAntCompileTask">            <classpath refid="class.path"/>        </taskdef>		        <jrc			destdir="${root.server}/reports"			tempdir="${java.io.tmpdir}"			keepjava="false"			xmlvalidation="true">   			<src>                <fileset dir="${root.server}/reports">                    <include name="*.jrxml"/>                </fileset>            </src>            <classpath refid="class.path"/>        </jrc>        <echo message="Report designs compiled in ${root.server}/reports"/>    </target>
Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Are you creating new .jasper files each time your application is run? Why not just use the JRAntCompile once and then store the .jasper files until or unless something in the .jrxml files has been modified? How often are you compiling the .jrxml files? I keep the .jrxml files in a seperate location from the actual application that produces the reports and only compile them when needed.

Link to comment
Share on other sites

Indeed, since the creation of reports is only a part of a bigger project, the compilation target is invoked every time the application is run. The .jrxml files and the .jasper files are located in the same directory.

 

Thank you for the hint. It might be a good idea to store them in separate locations, I guess. Additionally I will implement a method which compares the design files and the corresponding jasper files and starts the compilation only if required, i.e. if the design files are newer than the compiled reports.

 

regards,

dman

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...