Ant: make "available" throw an understandable error?

Posted by digitala on Stack Overflow See other posts from Stack Overflow or by digitala
Published on 2010-03-31T08:15:31Z Indexed on 2010/03/31 8:23 UTC
Read the original article Hit count: 283

Filed under:
|

When running ant, how do I make an <available /> block throw an adequate error message?

This is what I have so far:

<target name="requirements">
  <available classname="foo.bar.baz" property="baz.present" />
</target>

<target name="directories" depends="requirements" if="baz.present">
  <mkdir dir="build" />
</target>

<target name="compile" depends="directories">
  <!-- build some stuff -->
</target>

What I'm currently seeing when requirements fails is a message complaining about the ./build dir not being available. How can I change this so that a message is displayed about the missing class, such as "foo.bar.baz is not available"?

© Stack Overflow or respective owner

Related posts about java

Related posts about ant