ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fletcher, Michael \(Calgary\)" <>
Subject "Variable" Macros Properties
Date Wed, 12 Apr 2006 20:34:43 GMT
I would like to be able to take a macro parameter such as "devel" and
use this information to compute the actual path where the data is stored
(ex \\pca001\mypath).  Unfortunately I cannot use properties for these
values because they are immutable once set and I may use each macro more
than once.

How would I take a macro parameter and compute a path in a way that the
macro can be run more than once?

I am using Ant and some Ant macros to encapsulate deploying code in my
organization.  In the build.xml for each system I use a single ant task
such as this to deploy the application onto the server.


This is a simplified example of the macro definition.

	<macrodef name="deployCorporateWebApp">
		<attribute name="target-tier" default="pcaw2" />
		<!-- etc -->

			<!-- Setup the target.basepath property -->
			<condition property="target.basepath"
				<equals arg1="@{target-tier}"
arg2="pcaw2" />
			<condition property="target.basepath"
				<equals arg1="@{target-tier}"
arg2="pcaw2" />
			<fail unless="target.basepath"
				message="Unknown target-level." />
			<!-- Compute the rest of the properties. -->
			<property name="target.path" 
				value =
"${target.basepath}\@{target-name}" />
			<!-- Simplified example of the actualy code -->	
			<delete dir="${target.path}" />
			<copy todir="{target.basepath}"/>

This does not work because properties are immutable once set.

Michael Fletcher
Corporate and Executive Systems
(403) 296-4215

This email communication is intended as a private communication for the sole use of the primary
addressee and those individuals listed for copies in the original message. The information
contained in this email is private and confidential and If you are not an intended recipient
you are hereby notified that copying, forwarding or other dissemination or distribution of
this communication by any means is prohibited.  If you are not specifically authorized to
receive this email and if you believe that you received it in error please notify the original
sender immediately.  We honour similar requests relating to the privacy of email communications.
Cette communication par courrier electronique est une communication privee a l'usage exclusif
du destinataire principal ainsi que des personnes dont les noms figurent en copie.  Les renseignements
contenus dans ce courriel sont confidentiels et si vous n'etes pas le destinataire prevu,
vous etes avise, par les presentes que toute reproduction, transfert ou autre forme de diffusion
de cette communication par quelque moyen que ce soit est interdite.  Si vous n'etes pas specifiquement
autorise a recevoir ce courriel ou si vous croyez l'avoir recu par erreur, veuillez en aviser
l'expediteur original immediatement.  Nous respectons les demandes similaires qui touchent
la confidentialite des communications par courrier electronique.

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

View raw message