ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Reilly" <peter.kitt.rei...@gmail.com>
Subject Re: newbie help: conditional exec
Date Wed, 12 Sep 2007 07:29:25 GMT
On 9/12/07, David Weintraub <qazwart@gmail.com> wrote:
> Two steps:
>
> 1). After your test, do an <antcall> to call a new target
> 2). Us an "if" parameter in that target: For example:
>
> <available file="CVS\cvsArt.xml" property="artAvailable"/>
> <antcall target="artAvailable.target"/>
>
> <target name="artAvaliable.target if="artAvailable">
It is not good practice to use <antcall>.

The normal way is just to have the target in the dependence
list as normal, and use the if to stop it executing.
<project ..>
   ..
  <available file="CVS/cvsArt.xml" property="antAvailable"/>

  ..
  <target name="mytarget" if="artAvailable">
    .. do somthing with artAvail..
   </target>

Peter
> ...
>
> The other solution is to use the antContrib tasks which includes an <if> task:
>
> <if>
>    <available file="CVS/cvsArt.xml"/>
>    <then>
>         ...
>     </then>
> </if>
>
> I like a lot of the antContrib stuff, but you do have to make sure it
> is installed on all the machines that will use your build.xml file.
>
> On 9/11/07, Mario Madunic <hajduk@imag.net> wrote:
> > I have the following in my ant task to test for the existence of an xml file
> > after processing
> >
> > <available file="CSV\csvArt.xml" property="artAvailable" />
> >
> > What I want to do is run <exec> based on the above property value of true.
I
> > can't seem to find a task to do this. Any help will be appreciated.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>
>
> --
> --
> David Weintraub
> qazwart@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

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


Mime
View raw message