ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@bost.de>
Subject Re: [RFE] Default Help target on error ?
Date Tue, 25 Jul 2000 12:52:51 GMT
>>>>> "NL" == Nelson, Laird <Laird.Nelson@time0.com> writes:

 NL> (Obviously that syntax sucks, but you get the idea.  If that task
 NL> fails, ant exits with the specified message.  Perhaps this is an
 NL> overlap as well with the "available" task (I'll have to go back
 NL> and read the messages), only more generalized?)

Yes, think so - in a way. We'd need a task to stop Ant from within the
build file to complete that, something like a <die> task which would
just throw a BuildException with a given message?

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

On the other hand one can do the same using just if and unless on
targets as well as an echo task - it would be the more forgiving way
as well:

<target name="main" depends="dosomething,reporterror" />

<target name="dosomething" if="java1.2">
  .... do the stuff you need to do
</target>

<target name="reporterror" unless="java1.2">
  <echo message="Need JDK >= 1.2 to work" />
</target>

Just some random thoughts.

Stefan

Mime
View raw message