ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale Anson <>
Subject Re: detecting build failures with OUT exiting
Date Mon, 13 Jan 2003 20:19:51 GMT
Hi Mike,

I sent the following in response to another question this morning, looks 
like it answers your question as well.

Dale Anson


Hi Roman,

I've written a try/catch/finally task that I'm in the process of getting 
ready for submitting to the ant-dev group for consideration. You can 
download it at 

This zip contains some other tasks that you may or may not want. Docs 
are included in the zip.

Basically, you use the task like this:

<target name=...>
       <!-- put your tasks here -->

           <!-- do failure handling tasks here -->

           <!-- like java, this is optional -->

Dale Anson

Roman Rytov wrote:

> In my script I access VSS and at the beginning check out some files. At
> the end of the script I check them in back. I want to catch all failure
> situations and to make logical action (check those files in in my case).
> Is there a way to apply a kind of FINALLY in Ant?
> Roman Rytov
> --
> To unsubscribe, e-mail:   
> <>
> For additional commands, e-mail: 
> <>

Mike Castle wrote:

>I'm knew to ANT and still in the process of trying to get up to speed on
>everything, including still reading through _Java Development With Ant_.
>I have come into a job with an existing build infrastructure.  Normal
>builds are all ant, but the automated build stuff is a combination of shell
>scripts and ant.  I am trying to migrate all of the functions that shell
>script provides into the build file for a couple of reasons.  First,
>practice.  Second, being able to easily migrate build system back and forth
>between our Linux and Win32 boxes (this builds will eventually incorporate
>running the test suite automatically, and I'll probably bounce back and
>forth between environments until I get stuff in place to run them both).
>The project currently has the following layout:
>Now, all of the libraries are intended to be maintained independently for
>possible use in other applications, but currently nothing else uses them.
>Additionally, as the main project needs new features added, new features
>must be added to various libraries in parallel.  So, while it annoys the
>hell out of me, no one else is interested in turning all of the libraries
>into individually released components.
>At least the main project build file doesn't directly interface with all of
>the library xml files.  Instead we have a pseudo project that calls each of
>the other build files with <antfile/> in the appropriate order.
>Now, the problem with <antfile/>, at least as far as I have been able to
>read in the docs and ant-user archives, is that there is no
>failonerror="no" equivalent.  Nor do I see a general way to catch failures.
>So, if a file fails to compile, the automated build exits, and I can't send
>off an email from inside ant to the appropriate individuals telling them
>they need to buy the next round.
>So, is changing <antfile/> to <exec ant/> my only option?  For automated
>builds, we have some logger stuff set up to save all of the output, but
>that doesn't happen for regular builds.  So that may be a little tricky
>(then again, it may all ``just work'', haven't yet looked at anything down
>that route yet).
>Or I may just invoke myself with exec with the standard build target, and
>not have to worry about changing all of the <antfile/> tasks.
>What would my other options be?  What sort of gotchas are there to look for
>in replacing <antfile/> with <exec ant/>?  Are there any very near term
>plans for offering up failonerror type of handling for <antfile/>?  I'd
>seen some references for plans, mostly related to ant2, but there's so much
>noise showing up when I do searches that it might be getting lost.
>Any comments, ideas, useful search terms appreciated.

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

View raw message