ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Burgess, Benjamin" <>
Subject RE: Probs with property expansion in <for> loops
Date Tue, 30 Aug 2005 13:23:20 GMT
In core ant, properties are immutable.  Also, there are no <for> loops.
However, using ant-contrib you can add a for loop.  Also with
ant-contrib you will have to use <var name="updatelist" unset="true"/>
to unset the property.

Ben Burgess

-----Original Message-----
From: Rebhan, Gilbert [] 
Sent: Tuesday, August 30, 2005 9:18 AM
Subject: Probs with property expansion in <for> loops


i have a problem with properties in <for>

scenario =

Three lists :
- list with all environments that should be served
  (loaded outside all loops)
- list with all servers of one environment
  (loaded in loop 2)
- list of files to be deleted on those servers
- list of files to be copied to those servers
  (generated in the outer loop 1 by a java class,
    loaded in loop 3 and loop 4)

Buildfile structure :


<!-- property = list with all environments -->
<loadfile property="Lums" srcFile="K:\r1p1l01a1\luminfo.txt" />

	<target name="main" depends="doall" />

	<target name="doall">

		<!-- // start loop 1 // -->

	<for list="${Lums}" param="Lum">
	<untar src="K:\r1p1l01a1/@{Lum}/transfer/tarfile_@{Lum}.tar" 
	   overwrite="true" />
	<loadfile property="server" srcFile="K:\r1p1l01a1\server_@{Lum}"

<java classname="de. ... .ParseCCLogs" failonerror="true">
	<arg value="K:\r1p1l01a1/@{Lum}/transfer" />
	<arg value="K:\r1p1l01a1/@{Lum}/temp/updated.txt" />
	<arg value="K:\r1p1l01a1/@{Lum}/temp/deleted.txt" />

<!-- files to be deleted on all servers-->		
<loadfile property="updatelist"
srcFile="K:\r1p1l01a1/@{Lum}/temp/updated.txt" />

<!-- files to be copied to all servers-->
<loadfile property="deletelist"
srcFile="K:\r1p1l01a1/@{Lum}/temp/deleted.txt" />

	<!-- // start loop 2 //  -->
	<for list="${server}" param="server">
                       <!-- // start loop 3 // -->
		<for list="${deletelist}" param="delfile">
		<echo message="Delete file -> @{delfile}" />
		</for> <!-- // end loop 3 // -->
                         <!-- // start loop 4 // -->
		<for list="${updatelist}" param="copyfile">
		<echo message="Copy file -> @{copyfile}" />
		</for> <!-- // end loop 4 // -->

	</for>	<!-- // end Loop 2 // -->
</for><!-- // end Loop 1 // -->

Problem =

Once the first time the updatelist and deletelist are loaded for the
first environment = @{Lum} it cannot be overwrited for the next
environment in the list ${Lums}.

debugmode says :
Override ignored for property updatelist
Override ignored for property deletelist
when getting into the loop for the second @{Lum}

Question =

How to make that loops work with a list of input properties,
properties expanded correct ?

If for loops are the wrong way, what should i do instead ?

I wanted to avoid several foreach loops.

Any hints ?

Regards, Gilbert

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

This message, including any attachments, contains confidential information intended for a
specific individual and purpose, and is protected by law.  If you are not the intended recipient,
please contact sender immediately by reply e-mail and destroy all copies.  You are hereby
notified that any disclosure, copying, or distribution of this message, or the taking of any
action based on it, is strictly prohibited.

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

View raw message