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

  • Home
  • SEARCH
  • 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 4064718
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:53:29+00:00 2026-05-20T15:53:29+00:00

In Ant I want to define a target (called A ) that define a

  • 0

In Ant I want to define a target (called A) that define a property and antcall it from another target (called B). I want that the target B, after antcalling the target A, can access the property defined in the target A.

For example:

<target name="B">
    <antcall target="A" inheritAll="true" inheritRefs="true" />
    <echo>${myprop}</echo>
</target>
<target name="A">
    <property name="myprop" value="myvalue" />
</target>

However it doesn’t work and <echo>${myprop}</echo> doesn’t print myvalue (I think because the property myprop isn’t defined in B).

Is there any way to do that?

  • 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-20T15:53:30+00:00Added an answer on May 20, 2026 at 3:53 pm

    According to the Apache Ant FAQ:

        <target name="cond" depends="cond-if"/>
    
        <target name="cond-if" if="prop1">
          <antcall target="cond-if-2"/>
        </target>
    
        <target name="cond-if-2" if="prop2">
          <antcall target="cond-if-3"/>
        </target>
    
        <target name="cond-if-3" unless="prop3">
          <echo message="yes"/>
        </target>
    

    Note: <antcall> tasks do not pass property changes back up to the environment they were called from, so you wouldn't be able to, for example, set a result property in the cond-if-3 target, then do <echo message="result is ${result}"/> in the cond target.

    In this respect, it is impossible to do what you want using antcall.

    ========== edit ===========

    Try antcallback: AntCallBack is identical to the standard ‘antcall’ task, except that it allows properties set in the called target to be available in the calling target.
    http://antelope.tigris.org/nonav/docs/manual/bk03ch20.html

    Sample code pasted from the above page:

        <target name="testCallback" description="Test CallBack">
            <taskdef name="antcallback" classname="ise.antelope.tasks.AntCallBack" classpath="${antelope.home}/build" />
            <antcallback target="-testcb" return="a, b"/>
            <echo>a = ${a}</echo>
            <echo>b = ${b}</echo>
        </target>
    
        <target name="-testcb">
            <property name="a" value="A"/>
            <property name="b" value="B"/>
        </target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to define a target using a property as part of its name
I'm trying to define a task that emits (using echo) a message when a
I want to have/define a unique id for each data row in my Excel
What do I want to achieve? We are currently working on a PHP project
I'm having trouble getting my cruisecontrol script to do something. I want to call
My pom.xml is running an Ant task to deploy a file using FTP. However,
I have a script that takes a command and executes it on a remote
I have been struggling trying to figure out how to conditionally include Flex libraries
Could you, please, help with the following issue? When generate WS client code (with
I have an ASP.NET page with a drop down (asp:DropDownList) control. I also have

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.