ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: Conditional logic in ANT build scripts
Date Wed, 09 Apr 2003 07:06:09 GMT
On Wed, 9 Apr 2003, Andrew Zeon <> wrote:

> I have targets which should only be run for specific
> environments... how can I do this?

The way I do it:

<property file="${}"/>

at the top of the build file.  I'll most likely need different values
for a whole bunch of properties depending on the environment as well.

In I'd have a line


and I'd not define the same property in the other environments (but
similar properties with different names).

The conditional targets then would look like

<target name="run-only-for-live" if="is-live" ...

As a refinement (when using Ant >= 1.5) I'd drop the environment
property and the <property> above task completely and invoke Ant as

ant -propertyfile


View raw message