ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hobbs, Gareth" <Gareth.Ho...@astrazeneca.com>
Subject Looping/exception handling in Ant project
Date Mon, 06 Sep 2004 12:21:05 GMT
Hi,

I am using Ant to automate a processing pipeline - an Ant project is used to
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 succeed,
the last target in the project generates a "success" output document. If any
step fails, causing the project to fail, a custom subclass of DefaultLogger
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 a
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 naming
temporary files created by one target and picked up by the next.

I also need to preserve my exception handling - should the pipeline fail for
a particular input file, then the "success" and "failure" processing
outlined above should apply, but then the project should move onto the next
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 rather
than procedurally!

Your thoughts and suggestions gratefully received!

Thanks,
Gareth

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message