ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: Flow-Control
Date Fri, 10 May 2002 01:26:35 GMT
--- Eddie Bush <> wrote:
> Hi - I'm fairly new to ant so please don't laugh me off the list if
> there is an obvious solution to this that I have overlooked.
> I have a build file that will, by changing a property definition value
> (delploy.forreal) from false to true, will allow me to select either a
> development or production deployment.  I want to extend this concept to
> distributing a 'packed' (WAR) or unpacked application.  My problem is
> that I don't see any flow-control mechanism that would let me route to
> one alternative or the other in my 'deploy' task.

You have several alternatives. One would be to not set a "deploy.forreal"
property at all, since Ant's if/unless attributes don't check for value
(eg., "false" or "true"), but only for whether the named property is set
at all. Instead, just have a "production" property, which is only set when
doing a production deployment, and 'unless="production"' on your dev
deploy, and 'if="production"' on your production deploy.

If you go with the "deploy.forreal" being set to "false" or "true"
approach, you'd need to conditionally set another property to use for your
if/unless attrs -- eg:
  <condition property="production" value="true">
    <equals arg1="deploy.forreal" arg2="true"/>
and still if/unless on "production" in your deploy targets.

The third alternative is to use the ant-contrib <if> task (personally
highly recommended for this sort of thing, since having <target>'s
if/unless attributes do a test-for-equality is something I campaigned
strenuously for somewhere back in 2000, but was turned down flat, so
pointing people to the <if> task is my little revenge :)



Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message