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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -