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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:28:26+00:00 2026-05-23T04:28:26+00:00

Can Ant properties set via properties file, resolve other properties from properties files? For

  • 0

Can Ant properties set via properties file, resolve other properties from properties files?

For example, I can do this:

<property name="prop1" value="in_test_xml1" />
<property name="prop2" value="${prop1}" />

and prop2 becomes “in_test_xml1”. That’s good.

But in this case, when using an input properties file:

prop1=sample_prop
prop2=${prop1}

prop2 is not set to “sample_prop”

So resolving properties from other properties only seems to work when the property doing the resolving is in the ant file itself.

Is this expected or am i missing something?

  • 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-23T04:28:27+00:00Added an answer on May 23, 2026 at 4:28 am

    Ant does support in-file property expansion, see the Property File section in the manual for the Property task.

    The following example shows properties getting resolved:

    • within a single properties file
    • from one properties file in another properties file
    • within a build file

    First properties file:

    $ cat props1.properties
    prop1=world
    prop2=hello ${prop1}
    

    Second properties file:

    $ cat props2.properties
    prop3=goodbye ${prop1}
    

    Build file:

    <project default="test">
      <property file="props1.properties"/>
      <property file="props2.properties"/>
      <property name="prop4" value="${prop3}, good luck"/>
      <target name="test">
        <echo message="prop1 = ${prop1}"/>
        <echo message="prop2 = ${prop2}"/>
        <echo message="prop3 = ${prop3}"/>
        <echo message="prop4 = ${prop4}"/>
      </target>
    </project>
    

    Output:

    $ ant
    Buildfile: build.xml
    
    test:
         [echo] prop1 = world
         [echo] prop2 = hello world
         [echo] prop3 = goodbye world
         [echo] prop4 = goodbye world, good luck
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    

    Is there another kind of property resolution that is not working for you?

    Edit

    Following your comment, I now understand that you are using the -propertyfile command line option to specify a property file for Ant to load (rather than specifying the file in the buildfile itself, as I did above).

    I did quick test with this and find that Ant 1.7.1 did not do in-file property expansion on files loaded using that command line option. But Ant 1.8.2 does.

    This is Ant Bug 18732. You should be able to resolve by updating your version of Ant.

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

Sidebar

Related Questions

I'm used to work with properties files, for example from Ant. Where I can
In ant scripts and MS build files you can set properties at the top
I want to run a VBScript file from an Ant script. How can I
In ant, I need to load a set of .properties files based on a
How can i overwrite some existing property with a newly created properties file? Here
Is there a way in Ant which can check that a specified properties file
Can not run following SQL from ant's sql task : BEGIN DBMS_AQADM.CREATE_QUEUE_TABLE( queue_table =>
How can you run AsUnit test runner from Ant? I'm on the Mac OS
When you define an extension-point in an Ant build file you can have it
How can I rename 1..n file with ANT? I would like to rename any

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.