ant: iterator over properties file

Posted by scheibenkleister on Stack Overflow See other posts from Stack Overflow or by scheibenkleister
Published on 2010-06-16T19:10:25Z Indexed on 2010/06/16 19:12 UTC
Read the original article Hit count: 215

Filed under:

Hi,

all my projects and their versions are defined in a properties file like this:

ProjectNameA=0.0.1
ProjectNameB=1.4.2

I'd like to iterate over all projects and use there names and versions in an ant script. Right now, I read the entire properties file in help of the property task.

Then I iterate over a given list in a for loop like this:

<for list="ProjectNameA,ProjectNameB" param="project">
   <sequential>
    <echo message="@{project} has version ${@{project}}" />
   </sequential>
</for>

How can I avoid the duplication of the project names in the for loop. So basically iterate over each line and extract the name and the version of a project.

Thanks.

© Stack Overflow or respective owner

Related posts about ant