ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hobbs, Gareth" <Gareth.Ho...@astrazeneca.com>
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.

Cheers,
Gareth

-----Original Message-----
From: Olivier Croisier [mailto:Olivier.Croisier@thales-is.com]
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
idea.)

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

Hope this helps,
Olivier



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

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



-- 
CROISIER Olivier
Software Engineer
Thales IS - ANS
olivier.croisier@thales-is.com

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

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


Mime
View raw message