ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: "if" attribute, and "fail"
Date Tue, 20 Nov 2001 00:56:13 GMT
add this:

<target name="fail-foo" depends="check-foo" if="missing-foo">
  <fail/>
</target>

then depend your compile step on fail-foo.  obviously renaming the targets a
little might make things seem more sensible.

----- Original Message -----
From: "siege" <taliesein@yahoo.com>
To: <ant-user@jakarta.apache.org>
Sent: Monday, November 19, 2001 7:27 PM
Subject: "if" attribute, and "fail"


>
> Hello list,
>
> I'm relatively new to using ant (that is to say, new to using it for
> anything more than the most basic of build tasks), and have come across
> an anoying problem. I've searched through the FAQs referenced in the
> archives, but didn't see what I was looking for.
>
> What I'm attempting to do is to have a build process fail when a given
> class is not found. My closest attempt is the following:
>
>     <target name="check-foo">
>
>         <condition property="missing.foo">
>     <not>
>         <available classname="foo.Bar">
>     <classpath>
>         <fileset dir="${lib.dir}" />
>     </classpath>
> </available>
>     </not>
> </condition>
>
> <fail if="missing.foo">foo.Bar is missing</fail>
>
>     </target>
>
>
> Which seemed all well and good until ant kindly pointed out that the
> "if" attribute is not supported in "fail".
>
> The other targets which call check-foo as a depends use that class, and
> if it's not locatable the build goes crazy with import errors. I'm
> trying to forestall that by detecting the problem before I even get to
> the compile step.
>
> Any better ideas on how to do this, oh ant gurus? Any suggestions would
> be appreciated tremendously!
>
> -siege
> (Chris)
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
>
>


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


Mime
View raw message