ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Klein <mikekl...@sbcglobal.net>
Subject Questions about conditional tasks
Date Tue, 28 Oct 2003 23:17:23 GMT
I have a ant build script I would like to do both local and remote 
deployments of code with...

I have the following properties set in build.properties file (accessed 
by build.xml):

local.tomcat.host
local.tomcat.port
local.tomcat.home
ftp.user
ftp.password
remote.tomcat.host
remote.tomcat.port
remote.tomcat.home
deploy.local                  (A true/false value)

I wish to set tomcat.host, tomcat.port, and tomcat.home properties to 
the appropriate values (used by other ant tasks) based upon the value of 
deploy.local (true or false). I also in the deploy/undeploy tasks wish 
to do either a local copy command or ftp.

 From what I've seen in ant docs, the solution is a little unwieldy. I 
can only seem to check for presence of property, not whether it's true 
or false.

What I'm looking for is functionality like the following...does it exist?

    <target name="setProps">
         <test property="deploy.local">
             <iftrue>
                <property name="tomcat.home" value="${local.tomcat.home}"/>
                <property name="tomcat.host" value="${local.tomcat.host}"/>
                <property name="tomcat.port" value="${local.tomcat.port}"/>
             </iftrue>
             <iffalse>
                <property name="tomcat.home" value="${remote.tomcat.home}"/>
                <property name="tomcat.host" value="${remote.tomcat.host}"/>
                <property name="tomcat.port" value="${remote.tomcat.port}"/>
             </iffalse>
    </target>

Then later in my deploy/undeploy tasks I could do the same check and 
determine whether to copy or ftp the file.

I have thought about separating the build file into local and remote 
flavors...but it seems like to much of a chance for them to get out of 
sync...when their only difference is the property settings and whether 
copy or ftp gets done.

Any ideas?


thanks in advance,

mike


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


Mime
View raw message