ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Petar Tahchiev" <paranoia...@gmail.com>
Subject Re: how to conditionally execute a task
Date Wed, 12 Jul 2006 10:26:37 GMT
On 12/07/06, Rémon van Gijn <r.van.gijn@portinfolink.com> wrote:
>
> In ant you can use the "env" properties, in combination with the ant-contrib extension
that would allow you to create if statements.
>
> Met vriendelijke groet,
> Rémon van Gijn
>
>
>
> -----Original Message-----
> From: Nagender Malik [mailto:nagender_malik@intersolutions.stpn.soft.net]
> Sent: woensdag 12 juli 2006 12:05
> To: Ant Group
> Subject: how to conditionally execute a task
>
> Hi All,
>
> i want to execute  a task conditionally based on operating system property. how can we
do that.
>
> please suggest....
>
> thanks,
> Nagender Malik
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
I would suggest place your task in a target and then use the if
attribute of the target element like this:

<target name="blah" if="${Property}">
<your task/>
</target>

this will execute your task only if Property is set.

Something more: To check for your system property has some specific
value you can use condition and then based on this condition you can
initialise Property.

Hope this helps!
-- 
Regards, Petar!
Karlovo, Bulgaria.

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


Mime
View raw message