John D. Casey <[EMAIL PROTECTED]> wrote:

> Is there any way to specify "only execute this *task* if the
> following property is set"?

No - at least not for the built in tasks, you could add something like
this for your own tasks of course. Want me to add this to the Ant2
wish list?

> Also, is there a conditional that will only execute a target(or
> task) if a property equals _a_certain_value_?

No, but it has been asked for before. It has been declined by the
committers because we feared, this would open the door to
unmaintainable complexity too far. After test for equality we'd get
set inclusion, substring tests and so on.

You can achieve this test differently by doing something like this -
I'm testing whether property foo has the value bar:

<property name="dummy.${foo}" value="1" />
<target ... if="dummy.bar">

> We are using a different set of properties for builds for each
> environment we build for.

Maybe you can load your properties from a file? Something like

<property file="${env}.properties" />

where env would take the values production and developer on the
command line?

This could then include something like 

do.deploy=1

in production.properties, but no line for this property in
developer.properties at all. 

Just a random thought - but I think an approach like this would scale
to more than two types of environments better than testing for
property values.

Stefan

Reply via email to