ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan <raghure...@gmail.com>
Subject Multiple properties into one property key
Date Wed, 19 May 2010 04:41:01 GMT
Hi All,

I'm trying to read muliple properties into one property key is that possible
int ant?

For examble lets say i property file called name.properties in that i've
entries as shown below
name1=Joe
name2=Jan
numberofnames=2

now i want read these 2 property key value and assign to property
allNames=${name1},${name2}.....${namen}, coz i will know the value of
"numberofnames" only at runtime i used ant-contrib 1.0b3 like below

  <for param="num" end="${numberofnames}">
   <sequential>
    <if>
     <equals arg1="@{num}" arg2="0"/>
     <then>
      <echo message="XXXXX Skipping the as ant contrib start with value "0"
and there won't be any property like "name0" will be available"
level="verbose"/>
     </then>
     <else>
      <propertycopy name="name"        from="name@{num}"
override="true"/>
         <echo file="props.ext">${name}${line.separator}</echo>
         <loadfile srcfile="props.ext" property="${nameList}">
           <filterchain>
             <filterreader
classname="org.apache.tools.ant.filters.TailFilter">
               <param name="lines" value="${numberofnames}"/>
             </filterreader>
           </filterchain>
         </loadfile>
     </else>
    </if>
   </sequential>
  </for>

This does stores all name1 and name2 value into props.ext file,  but when i
tried ito read the file usine "loadfile" its just prints the name1 only not
name2

Anyidea?

Thanks in advance for your help

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message