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 6607173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:28:29+00:00 2026-05-25T19:28:29+00:00

I have this dummy target: <mkdir dir=${project.stage}/release <war destfile=${project.stage}/release/sigma.war> … … </war> What I

  • 0

I have this dummy target:

<mkdir dir="${project.stage}/release 
<war destfile="${project.stage}/release/sigma.war">
    ...
    ...
  </war>

What I want to do is provide two parameters say “abc” & “xyz” which will replace the word release with the values of abc and xyz parameters respectively.

For the first parameter say abc=”test”, the code above will create a test directory and put the war inside it.Similarly for xyz=”production” it will create a folder production and put the war file inside it.

I tried this by using

<antcall target="create.war">
    <param name="test" value="${test.param.name}"/>
    <param name="production" value="${prod.param.name}"/>
</antcall>

in the target which depends on the dummy target provided above.
Is this the right way to do this.I guess there must be some way to pass multiple parameters and then loop through the parameters one at a time.

  • 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-25T19:28:30+00:00Added an answer on May 25, 2026 at 7:28 pm

    unfortunately ant doesn’t support iteration like for or foreach loops unless you are refering to files. There is however the ant contrib tasks which solve most if not all of your iteration problems.

    You will have to install the .jar first by following the instructions here : http://ant-contrib.sourceforge.net/#install

    This should take about 10 seconds. After you can simply use the foreach task to iterate through you custom list. As an example you can follow the below build.xml file :

    <project name="test" default="build">
    <!--Needed for antcontrib-->
    <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
    <target name="build">
    <property name="test" value="value_1"/>
    <property name="production" value="value_2"/>
    
    <!--Iterate through every token and call target with parameter dir-->
    <foreach list="${test},${production}" param="dir" target="create.war"/>
    
    </target>
    <target name="create.war">
        <echo message="My path is : ${dir}"/>
    </target>
    </project>
    

    Output :

    build:
    
    create.war:
     [echo] My path is : value_1
    
    create.war:
     [echo] My path is : value_2
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    

    I hope it helps 🙂

    Second solution without using ant contrib. You could encapsulate all your logic into a macrodef and simply call it twice. In any case you would need to write the two parameters at some point in your build file. I don’t think there is any way to iterate through properties without using external .jars or BSF languages.

    <project name="test" default="build">
    <!--Needed for antcontrib-->
    <macrodef name="build.war">
      <attribute name="dir"/>
      <attribute name="target"/>
      <sequential>
      <antcall target="@{target}">
            <param name="path" value="@{dir}"/>
      </antcall>
      </sequential>
    </macrodef>
    
       <target name="build">
       <property name="test" value="value_1"/>
       <property name="production" value="value_2"/>
    
       <build.war dir="${test}" target="create.war"/>
       <build.war dir="${production}" target="create.war"/>
    
    
       </target>
       <target name="create.war">
          <echo message="My path is : ${path}"/>
       </target>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem. This is my code: var method = new DynamicMethod(dummy, null, Type.EmptyTypes);
I have this string 2012-06-27 16:17:06 and I want to convert it to GMT
I have this strange issue. Xcode target does not find my 3rd party mac
i have this (simplified) <script> dataToSend = 'dummy data here'; function sendIt() { //code
I have the following .htaccess at the moment. This is a dummy copy paste
PROBLEM: I have a program dummy.exe on windows. this program will bind to UDP
I tried this dummy code below to test unnamed namespace. I have the following
I have this variable: var search = dummy; var replace = <strong> + search
I've started to play with require js on a dummy project. I now want
Let's say I have this dummy Perl package in test.pm : package test; use

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.