Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Read more than one text file for a foreach loop in ant and store the line values as different properties

Rank

Total Posts: 1

Joined 2016-03-24

PM

I have an urgent requirement with respect to ant loops.
It says i have 3 different text files each with say 3 lines (each line is a one word string for all files).
Now i need a foreach loop in ant that reads all 3 files at same time for the first line in each file and stores the values accordingly as 3 different properties. This way for every single iteration of loop i can refer to a target where i can pass these properties for target execution. The loop will hence run 3 times and execute that target 3 times one for each iteration.

say for example i have the following sample code:-
<target name="read">
<loadfile property="file" srcfile="./dist/DB_Critical_Stub_Data.txt">
<loadfile property="fileversion" srcfile="./dist/version.txt">
<loadfile property="filecomponent" srcfile="./dist/component.txt">
<foreach list="${file},${fileversion},${filecomponent}" param="line,line1,line2" delimiter="${line.separator}" target="start-stub">
</target>
<target name="start-stub">



<startStub name="${stub-name}" versi comp>
</target>      
Avatar
RankRankRankRank

Total Posts: 296

Joined 0

PM

I suspect that you've picked the wrong forum for your question.
The forum you posted in deals with ANT, a family of network protocols and related hard and software (https://en.wikipedia.org/wiki/ANT_(network)).
Your question seems like being related to the Apache ANT software build system.
OMB