Jump to content
Changes to the Jaspersoft community edition download ×

ANT Task to compile report that uses a helper


Recommended Posts

By: Santosh Mani - santoshm

ANT Task to compile report that uses a helper

2003-10-16 13:56

Hi List,

 

I am using the JasperReports ANT task to compile a report design that uses a custom helper class in one of its expressions.

 

This is my ANT script:

---------------------------------------------

<taskdef name="jrc" classname="dori.jasper.ant.JRAntCompileTask">

<classpath>

<pathelement location="${jasper.root.dir}/lib/jasperreports-0.5.0.jar"/>

</classpath>

</taskdef>

<target name="compile-helpers">

<!-- Compile Helper Classes-->

<javac srcdir="${jasper.helpers.source}" destdir="${jasper.compiledhelpers.dir}" classpath="${jasper.root.dir}/lib/jasperreports-0.5.0.jar"/>

<jar jarfile="${jasper.root.dir}/lib/jasperHelpers.jar"><fileset dir="${jasper.compiledhelpers.dir}" includes="**/*.class"/></jar>

</target>

<target name="compile-reports" depends="compile-helpers">

<!-- Compile Reports -->

<jrc srcdir="${jasper.source.dir}" destdir="${jasper.compiledreports.dir}">

<classpath><fileset dir="${jasper.root.dir}/lib"><include name="*.jar"/></fileset></classpath>

</jrc>

</target>

--------------------------------------------

But I get a stacktrace that seems to be complaining about not being able to find the helper class.

Any suggestions welcome.

 

Thanks,

Santosh

 

[jrc] Error compiling report design : C:developLA2_ServerSourcejasperbincompiledreportsbudgetsbudget_stock_numbers.

[jrc] java.lang.ClassNotFoundException: nz.co.nbnz.cat.reports.utils.LongHolder

[jrc] at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1075)

[jrc] at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1036)

[jrc] at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:925)

[jrc] at java.lang.ClassLoader.loadClass(ClassLoader.java:250)

[jrc] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)

[jrc] at java.lang.Class.forName0(Native Method)

[jrc] at java.lang.Class.forName(Class.java:190)

[jrc] at dori.jasper.engine.util.JRClassLoader.loadClassForName(JRClassLoader.java:123)

[jrc] at dori.jasper.engine.xml.JRParameterFactory.createObject(JRParameterFactory.java:102)

[jrc] at org.apache.commons.digester.FactoryCreateRule.begin(FactoryCreateRule.java:291)

[jrc] at org.apache.commons.digester.Digester.startElement(Digester.java:1237)

[jrc] at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)

[jrc] at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)

[jrc] at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)

[jrc] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)

[jrc] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

[jrc] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

[jrc] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[jrc] at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)

[jrc] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

[jrc] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

[jrc] at org.apache.commons.digester.Digester.parse(Digester.java:1514)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:373)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:357)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:337)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323)

[jrc] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:121)

[jrc] at dori.jasper.ant.JRAntCompileTask.compile(JRAntCompileTask.java:391)

[jrc] at dori.jasper.ant.JRAntCompileTask.execute(JRAntCompileTask.java:239)

[jrc] at org.apache.tools.ant.Task.perform(Task.java:341)

[jrc] at org.apache.tools.ant.Target.execute(Target.java:309)

[jrc] at org.apache.tools.ant.Target.performTasks(Target.java:336)

[jrc] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)

[jrc] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)

[jrc] at org.apache.tools.ant.Main.runBuild(Main.java:609)

[jrc] at org.apache.tools.ant.Main.start(Main.java:196)

[jrc] at org.apache.tools.ant.Main.main(Main.java:235)

 

[jrc] NESTED BY :

[jrc] dori.jasper.engine.JRException: nz.co.nbnz.cat.reports.utils.LongHolder

[jrc] at dori.jasper.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:397)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:357)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:337)

[jrc] at dori.jasper.engine.xml.JRXmlLoader.load(JRXmlLoader.java:323)

[jrc] at dori.jasper.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:121)

[jrc] at dori.jasper.ant.JRAntCompileTask.compile(JRAntCompileTask.java:391)

[jrc] at dori.jasper.ant.JRAntCompileTask.execute(JRAntCompileTask.java:239)

[jrc] at org.apache.tools.ant.Task.perform(Task.java:341)

[jrc] at org.apache.tools.ant.Target.execute(Target.java:309)

[jrc] at org.apache.tools.ant.Target.performTasks(Target.java:336)

[jrc] at org.apache.tools.ant.Project.executeTarget(Project.java:1339)

[jrc] at org.apache.tools.ant.Project.executeTargets(Project.java:1255)

[jrc] at org.apache.tools.ant.Main.runBuild(Main.java:609)

[jrc] at org.apache.tools.ant.Main.start(Main.java:196)

[jrc] at org.apache.tools.ant.Main.main(Main.java:235)

 

 

 

 

By: Gregory A. Swarthout - gswarthout

RE: ANT Task to compile report that uses a he

2003-10-16 14:21

Try building your helper jar before calling jrc, perhaps making it available to the jrc taskdef as part of its classpath as well. Also, I think you need all of the jars in the JasperReports/lib directory as part of the classpath for the jrc taskdef's class path as well as in the jrc task's classpath.

 

 

 

 

By: Santosh Mani - santoshm

RE: ANT Task to compile report that uses a he

2003-10-19 13:57

Hi,

 

I included the jar of the helper classes in the classpath of the taskdef and moved the taskdef into the compile-reports task and that worked!

 

Thanks!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...