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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:23:12+00:00 2026-05-16T11:23:12+00:00

I have a set of nested Ant build files, and I need to control

  • 0

I have a set of nested Ant build files, and I need to control which properties are inherited by each “sub” task. I’m trying to define these as propertysets (to keep the code manageable) but these are not inherited by subtasks, unlike properties.

The example below demonstrates the problem, foo.* get copied into the middle project but not to the bottom project. If I define each property to be inherited explicitly, like bar.*, they get inherited by the bottom project too.

Is there any way to get a group of properties to inherit all the way down, in the same way individual properties do? Without rewriting the sub-processes, is there something else I could try?

[top.xml]

<?xml version="1.0"?>
<project name="test-top">
    <property name="foo.1" value="1"/>
    <property name="foo.2" value="2"/>
    <property name="bar.1" value="1"/>
    <property name="bar.2" value="2"/>

    <ant antfile="middle.xml" inheritall="false">
        <propertyset>
            <propertyref prefix="foo."/>
        </propertyset>
        <property name="bar.1" value="${bar.1}"/>
        <property name="bar.2" value="${bar.2}"/>
    </ant>
</project>

[middle.xml]

<?xml version="1.0"?>
<project name="test-middle">

    <echo>foo ${foo.1} ${foo.2}</echo>
    <echo>bar ${bar.1} ${bar.2}</echo>

    <ant antfile="bottom.xml" inheritall="false"/>
</project>

[bottom.xml]

<?xml version="1.0"?>
<project name="test-bottom">

    <echo>foo ${foo.1} ${foo.2}</echo>
    <echo>bar ${bar.1} ${bar.2}</echo>

</project>

[OUTPUT OF ant -f top.xml]

 [echo] foo 1 2
 [echo] bar 1 2
 [echo] foo ${foo.1} ${foo.2}
 [echo] bar 1 2
  • 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-16T11:23:12+00:00Added an answer on May 16, 2026 at 11:23 am

    I think Alexander’s solution is close. How about this though, doesn’t need any change in middle.xml or bottom.xml.

    The idea is to use the echoproperties task to ‘unroll’ the propertyset to individual properties, then to use that in the ant task call.

    Before calling middle.xml, write the property set out using something like this:

    <echoproperties destfile="myproperties.txt">
        <propertyset>
            <propertyref prefix="foo."/>
            <propertyref prefix="bar."/>
        </propertyset>
    </echoproperties>
    

    Then make the call to middle.xml:

    <ant antfile="middle.xml" inheritall="false">
        <property file="myproperties.txt" />
    </ant>
    

    Properties supplied to the ant task inherit all the way down as you say, so you only need to change top.xml:

    These properties become equivalent to
    properties you define on the command
    line. These are special properties and
    they will always get passed down, even
    through additional <ant> tasks with
    inheritall set to false (see above).

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

Sidebar

Related Questions

I have a set of nested DIV 's and I need to find each
I have a build.xml which imports other ant xml files. I'd like to get
I have a build.xml to use with ant, and I'm trying to put a
I have a nested data object for a set of items within categories. Each
I have an Entity type which uses the nested set extension. When I am
Is it possible to have nested set capabilities in this somewhat custom setup? Consider
I have your run of the mill nested set hierarchy type setup with the
I have a method with a nested foreach collection (iterate a set of objects
I'd like to have the nested containers inherit that property, but when I set
I have a set of nested unordered lists that represents page navigation. The list

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.