Jump to content
Changes to the Jaspersoft community edition download ×

Ant Task for compile JasperReport source file


Recommended Posts

By: Henri Chen - henrichen

Ant Task for compile JasperReport source file

2002-06-24 02:07

Hi, Teodord,

 

I have finished the Ant task for compiling JasperReport xml file. The code is sent directly to your hotmail email account. This task inherits the ant's Javac task thus allow all attributes and elements of the javac. However, It adds two new attributes, saxdriver and codedir.

 

saxdriver="org.apache.xerces.parsers.SAXParser"

//to specify approiate XML parser; if not specified, would use "org.apache.xerces.parsers.SAXParser" as the default.

 

codedir="...

//to specify the directory to generate the expression java code and compiled class files

 

Except attribute srcdir, destdir, and nested element src, all the other attributes or elements are the same to the javac task.

 

The srcdir attribute and src nested element of this task are used to describe the original JasperReport xml layout files while the destdir attribute is used to tell the task where to generate the Xxx.jasper files.

 

The base of the generated jasper file name would be the same as the base of the source file name. That is, a source file of the name <srcdir>/abc/def/xyz.xml would generate a destination file of <destdir>/abc/def/xyz.jasper. The same to the javac, if the destdir is not specified, the jasper file would be generated at the same directory as the source file. Note that this task does not limit the source file extension to have to be "xml". It can be any extension as long as it is a leagal Jasper Report layout file.

 

To use this task, the ant classpath has to include jasperreports.jar and all those jars used by the jasperreports.jar plus jakarta ORO regular expression library (the newest verion jakarta-oro-2.0.6.jar) which is used by this task.

 

Example:

In the ant's build.xml

 

<taskdef name="jrc" classname="org.apache.tools.ant.taskdefs.JasperCompileTask"/>

...

<target name="compile.jasper">

<jrc srcdir="." destdir="./jasper" codedir="/tmp">

<include name="reports/**/*.xml"/>

</jrc>

</target>

 

This would compile all JasperReport source xml file under directory reports/ to directory /jasper as JasperReport Xxx.jasper files.

 

I have to admit that I am not an Ant expert, but the code seems works fine. Please take a look and comments are welcome.

If it is ok to you, I would contribute it back to the JasperReport project.

 

Henri Chen

henrichen@infoshock.com.tw

 

 

 

 

By: Teodor Danciu - teodord

RE: Ant Task for compile JasperReport source file

2002-07-23 02:29

 

Hi,

 

I haven't got the chance to test it, but if everything

is OK it will be included in the next version.

 

Thank you,

Teodor

 

 

 

 

 

By: Maurice C. Parker - mauricevineyard

RE: Ant Task for compile JasperReport source

2002-07-23 06:09

Teodor,

 

Have you considered moving the source tree into your sourceforge CVS repository yet? It would make it much easier for people to help you with that aren't your highest priority.

 

For example this feature is very important to me and it was important enough to Henri that he wrote it. If it was in CVS I would have access to the source code and could test it and offer feed back. This would increase the quality of this feature prior to the next release and would make it more likely to be included.

 

This doesn't mean you automatically give us access to the CVS repository. It just means we would have a central code location that can work from, make patches on, and have you merge.

 

Of course, if you have any intentions of building a team then moving to CVS is very necessary.

 

-Maurice

 

 

 

 

By: Teodor Danciu - teodord

RE: Ant Task for compile JasperReport source

2002-07-23 07:33

 

Hi,

 

You're absolutely right!

I'll do it first thing after returning from my holidays.

 

We'll talk about it in august.

 

Thank you,

Teodor

 

 

 

 

 

By: Maurice C. Parker - mauricevineyard

RE: Ant Task for compile JasperReport source

2002-07-22 21:14

Teodord, is this going to be distributed with JasperReports? I need the Jasper Ant task for the work we are doing to use JasperReports as a View from WebWork (http://www.opensymphony.com/webwork/).

 

Henri, if this isn't going to be distributed w/JasperReports could you send me the source so that I would be able to use it?

 

Thanks!

 

-Maurice

 

 

 

 

By: Henri Chen - henrichen

RE: Ant Task for compile JasperReport source

2002-08-02 02:45

Hi, Maurice,

 

No problem. If you need the source now, just pass me your email address. The task has been working for me.

 

Please reply to my email directly, I check this forum every one to two weeks.

 

Henri

henrichen@infoshock.com.tw

 

 

 

 

By: Henri Chen - henrichen

RE: Ant Task for compile JasperReport source

2002-12-03 20:21

Hi,

 

I keep getting requests on this Ant task code, thus I decided to upload the code to Patch area. If anyone interested about it; then he/she can get it

here. (The patch area)

http://sourceforge.net/tracker/?group_id=36382&atid=416705

 

Henri Chen

henrichen@infoshock.com.tw

 

 

 

 

 

By: Bernd Proissl - berndproissl

RE: Ant Task for compile JasperReport source

2002-07-11 02:07

Hi Teodor,

 

I tried to use Henri's code but unfortunately id needs public access to method JRClassGenerator.generateClass(jasperDesign).

 

Can you change this method to public?

 

Thanks

Bernd

 

 

 

 

 

By: Teodor Danciu - teodord

RE: Ant Task for compile JasperReport source

2003-04-14 13:03

 

Hi,

 

After months, we finally have an Ant task included

in the main distribution.

Many thanks to Henri Chen and Kees Kuip for

their patches.

 

Thank you,

Teodor

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