You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jake Ewerdt <ja...@emeta.com> on 2004/01/03 00:16:43 UTC

ant call on exit

My build.xml file creates a lock file at the beginning and deletes it at the 
end.  However, if there is a problem with compiling or the unittests, that 
lockfile doesn't get deleted.  Is there some way to specify that a target 
gets called on exit (preferrably even SIGINT)?

I read in the documentation that you can write a listener that gets called 
when the build exits, but will that listener get called if the build does not 
exit successfully?

Thanks,

-jake

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


Re: ant call on exit

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Jan 2, 2004, at 6:16 PM, Jake Ewerdt wrote:
> I read in the documentation that you can write a listener that gets 
> called
> when the build exits, but will that listener get called if the build 
> does not
> exit successfully?

Yes.  To detect an error, the buildFinished event will have an 
exception attached to it.  Have a look at the built-in loggers and 
listeners for examples (the MailLogger, for example, detects whether an 
error occurred or not).

	Erik


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


Re: ant call on exit

Posted by Wascally Wabbit <wa...@earthling.net>.
Jake,

We had similar problems (long ago). We wrote the <protect> task in
AntXtras to solve this problem. FYI:

    [create lock]
    <protect>
       [do stuff that can signal error]
       <always>
          [release lock]
       </always>
    </protect>

At 06:16 PM 1/2/2004, you wrote:
>My build.xml file creates a lock file at the beginning and deletes it at the
>end.  However, if there is a problem with compiling or the unittests, that
>lockfile doesn't get deleted.  Is there some way to specify that a target
>gets called on exit (preferrably even SIGINT)?
>
>I read in the documentation that you can write a listener that gets called
>when the build exits, but will that listener get called if the build does not
>exit successfully?
>
>Thanks,
>
>-jake

The Wabbit 



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