java - Ant foreach avoiding empty variables -
i have following line in build.xml
file:
<foreach list="${clients}" delimiter="," target="clean other hosts" param="client.string"/>
however, if ${clients}
empty (it contains maybe new-line character, because read file), calls target once.
is there workaround, prevent happen (the calling of loop)?
technically, task correct, because "".split(",")
equals {""}
. can work around problem wrapping task <if>
task:
untested:
<if> <not><equals arg1="${clients}" arg2="" /></not> <then> <foreach list="${clients}" delimiter="," target="clean other hosts" param="client.string"/> </then> </if>
Comments
Post a Comment