ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Duncan Davidson" <>
Subject Re: [RFE] Default Help target on error ?
Date Fri, 28 Jul 2000 18:42:30 GMT
on 7/28/00 11:02 AM, Jesse Glick at wrote:

> Stefan Bodewig wrote:
>> <target name="check">
>> <available name="java1.2" classname="java.lang.ThreadLocal" />
>> </target>
>> <target name="dieIfCheckFailed" unless="java1.2">
>> <die message="Need JDK >= 1.2 to work" />
>> </target>

So, I don't see the rest of the xml file here, but I assume that
dieifCheckFailed is on the dependency list somewhere for the main target?

> I like this style...if a command I need for a build to finish simply
> isn't there, I want to build to stop, immediately, with non-zero exit
> status. A <die> task would be trivial to write and I would use it at
> least.

Just don't use System.exit please. Use an AntException or some such that
will rip up the build stack to the start and have the Main catch the
exception, print out the reason, then return.

One of the things on my perpetual "if I had time" list is to go through and
hunt down all the System.exit calls and replace them with non destructive
bail outs. The reason is that why you use Ant inside some other Java
program, it really isn't nice for the System to get yanked out from under
the parent program (as it was the other day when I was playing with JShell).


View raw message