我使用螞蟻來取代一個URL值:循環6次,但打印的9倍,而不是3
<property name="dir" value="dir1, dir2, dir3" />
<property name="files" values="file1, file2, file3" />
我想在像DIR1組合替換URL值,則文件1 DIR2 ,file2然後dir3,file3。我循環兩次取代,而不是打印三次,並更換所有的值,它的替換和打印6次。
這裏是我的代碼:
<target name="test">
<foreach param="dirval" in="${dir}">
<foreach param="filesval" in="${files}">
<sequential>
<echo message="Testing structure: ${dirval}/${filesval}" />
</sequential>
</foreach>
</foreach>
輸出預計:
Testing structure: dir1/file1
Testing structure: dir2/file2
Testing structure: dir3/file3
不過的了:
Testing structure: dir1/file1
Testing structure: dir1/file2
Testing structure: dir1/file3
Testing structure: dir2/file1
Testing structure: dir2/file2
Testing structure: dir2/file3
Testing structure: dir3/file1
Testing structure: dir3/file2
Testing structure: dir3/file3
嗯,我不知道如何用Java做的,但我在這裏找一個螞蟻的專家,因爲他們可能知道這個問題並且知道得更好 – fscore 2015-03-25 13:25:58