Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3242738
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:21:02+00:00 2026-05-17T18:21:02+00:00

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

  • 0

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 the projects, and use their names and versions in an Ant script.

At present I read the entire file using the property task, then 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 hard-coding of the project names in the for loop?
Basically iterate over each line and extract the name and the version of a project as I go.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:21:02+00:00Added an answer on May 17, 2026 at 6:21 pm

    Seeing as you’re already using antcontrib for, how about making use of the propertyselector task:

    <property file="properties.txt" prefix="projects."/>
    <propertyselector property="projects" match="projects\.(.*)" select="\1"/>
    
    <property file="properties.txt" />
    <for list="${projects}" param="project">
        ...
    </for>
    

    The idea here is to read the properties once with the projects prefix, and use the resulting set of properties to build a comma-separated list of projects with the propertyselector task. Then the properties are re-read without the prefix, so that your for loop can proceed as before.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I built myself a MySQL class which I use in all my projects. I'm
[UPDATE] the clean goal runs smoothely all over the projects of the solution, the
I have a work page that shows all projects. I am using a taxonomy
In VS2010 they added to all projects a virtual directory called External Dependencies: alt
I am running xcode 4.3.2 and just started having the following problem. All projects
The list of all the projects we work stay (even after we close them)
Does anyone know a trick to change all web projects in a Visual Studio
I have a problem after i setup windows 7 all old projects in c#
In almost all of my projects I have few files that are project wide
I've got a Solution with lots of projects and all but one of them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.