ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Zeon <>
Subject Conditional logic in ANT build scripts
Date Wed, 09 Apr 2003 06:54:49 GMT

I know that the 'if' attribute in the 'target' task can be used to determine
whether or not a target should be executed. However, it is my understanding
that the 'if' attribute does not take into consideration the value of the
property... it merely checks its presence. Is there a way I can dynamically
determine whether or not a target is to be executed according to the actual
value of a property?

The reason why I ask is I have a build script, but that build script's
behaviour has to be different for different environments. This is how I
invoke my script:

"ant -Denvironment=dev dist"

for the development environment

"ant -Denvironment=staging dist "

for the staging environment

ant -D environment=live dist

for the live environment

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


View raw message