I’m having issues in trying to iterate values defined in a property file. I’m trying to read jar files in a loop and copy them to a directory. The jar file names are defined in a property file. Here’s my sample file :
<?xml version="1.0"?><project name="beehive" basedir=".">
<taskdef resource="net/sf/antcontrib/antlib.xml"/>
<loadfile property="file.list" srcFile="test.txt">
<!--<filterchain>
<striplinebreaks/>
</filterchain>-->
</loadfile>
<target name="testtarget">
<for list="${file.list}" param="fileName">
<sequential>
<echo>@{fileName}</echo>
<copy file="C:/Development/Doc/Build/@{fileName}" todir="C:/Development/Doc/Build/testdir">
</copy>
</sequential>
</for>
</target>
Here’s the entry in test.txt.
wikihelp-1.0.0.jar
velocity-1.0.0.jar
I’m expecting that the for loop will read file name one at a time then perform the copy. Instead,its reading the 2 file names together and throwing the following exception :
Warning: Could not find file C:\Development\Doc\Build\wikihelp-1.0.0.jar velocity-1.0.0.jar to copy.
Any pointers will be appreciated.
- Thanks
Found the issue, adding delimiter=”${line.separator} resolved it
In the for loop, I needed to add the delimeter for line seperator