ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hobbs, Gareth" <>
Subject RE: Looping/exception handling in Ant project
Date Mon, 06 Sep 2004 13:46:37 GMT
Many thanks Olivier.

I had thought of that (or doing the same in a Java program) and it could be
the best solution. However, architecturally I had hoped to accomplish
everything using Ant. It is harder to justify using Ant at all for this
application if I cannot meet all the polling and pipeline management
requirements without additional coding.


-----Original Message-----
From: Olivier Croisier []
Sent: 06 September 2004 13:39
To: Ant Users List
Subject: Re: Looping/exception handling in Ant project

Have you tried outsourcing the problem ?
I mean, to use your OS's batch commands to loop on the directory's files and
call ant for each of them, rather than looping from within your ant task ?

With linux's bash it can be done very easily. For example :
for i in *.input; do ant -file "$i"; done;

(assuming your files are named with a ".input" extension, and your ant task
takes a -file argument to designate the file to work on...  You get the

This must also be possible using the Windows "shell"...

Hope this helps,

On Mon, 6 Sep 2004 13:21:05 +0100, Hobbs, Gareth
<> wrote:

> Hi,
> I am using Ant to automate a processing pipeline - an Ant project is used
> define a sequence of processing steps to be applied to an input file
> (usually by way of a target containing an XSLT task). If all steps
> the last target in the project generates a "success" output document. If
> step fails, causing the project to fail, a custom subclass of
> generates a "failure" output document.
> This works well for a single input file - I currently pass the input
> filename property to the project as a command-line argument.
> However, I need to execute the pipeline iteratively over multiple input
> files - a specific input directory may contain more than one file matching
> given pattern. I can't process all files within each target, as there are
> assumptions made that only one file is being worked on, such as when
> temporary files created by one target and picked up by the next.
> I also need to preserve my exception handling - should the pipeline fail
> a particular input file, then the "success" and "failure" processing
> outlined above should apply, but then the project should move onto the
> matching file instead of terminating.
> At present I can only think of creating an outer project that calls the
> existing project within a loop (using <foreach>) and an exception handler
> (using <trycatch>). I am not sure of the release status of the cc-contrib
> code and whether its appropriate to use this within my validated
> application. In any case, I would prefer to solve this declaratively
> than procedurally!
> Your thoughts and suggestions gratefully received!
> Thanks,
> Gareth
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Software Engineer
Thales IS - ANS

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message