You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Raf Colson <ra...@alcatel.be> on 2000/09/19 15:29:48 UTC

clean way to stop building?

Hello,

I was wandering if there exists a clean way to stop the buildproces, for
example when some resource (like a property file) is not available I
don't want the buildproces to continue. I'd like to see it stop with
some message indicating what was wrong.

greetings
Raf

Re: clean way to stop building?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "RC" == Raf Colson <ra...@alcatel.be> writes:

 RC> Hello, I was wandering if there exists a clean way to stop the
 RC> buildproces,

In Ant 1.2 there's going to be a fail task for this. Until then the
only thing I can think of right now would be something like

<target name="check">
  <available property="ok" ...
</target>

<target name="fail" depends="check" unless="ok">
  <echo message="Resource not found" />
</target>

<target name="work" depends="check" if="ok">
...
</target>

<target name="check.and.run" depends="fail,work" />

which won't stop the build process but do nothing if things are not
set up correctly.

Stefan

Re: clean way to stop building?

Posted by Peter Donald <do...@mad.scientist.com>.
At 03:29  19/9/00 +0200, you wrote:
>I was wandering if there exists a clean way to stop the buildproces, for
>example when some resource (like a property file) is not available I
>don't want the buildproces to continue. I'd like to see it stop with
>some message indicating what was wrong.

Someone just submitted a patch a few hours to do just that may make it into
build soon (hopefully) - otherwise if you got a recent version there is a
task fail that can be used to do the same. You can make it exist in a
target that has unless="my-property" so that it will not get executed when
property is set. Then just add it into dependencie of all targets.

Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*