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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:06:11+00:00 2026-06-01T08:06:11+00:00

I am using apache ant in the following way: I have projects P1, P2,

  • 0

I am using apache ant in the following way:

I have projects P1, P2, P3. Some of those projects have modules, let say P2 has M1, M2, etc.
All projects have their own ant build script, and all of them have to implement set of predefined targets (build, dist, etc), the scripts expect some properties to be defined when called. let say (build.dir.base)

The modules follow similar structure, so every modules, has its own build file that implements the predefined set of targets, and expects some properties to be set. (let say build.dir.base – same as for the projects)

I also have a global ant script that builds all the projects (or subset)

In code that would look like:

build-all.xml:

<project name="x">
    <property name="build.dir.base" location="system.build.base" />
    <target name="build">
        <echo message="build.dir.base as defined for build-all.xml=${build.dir.base}" />
        <subant antfile="build.xml" target="build" inheritAll="false" inheritRefs="false">
            <dirset dir="${system.base}" includes="${project-list}" />
            <property name="build.dir.base" location="${build.dir.base}" />
        </subant>
    </target>
</project>

build.xml (one for each project with modules, no subant if project does not have modules):

<project name="y">
    <property name="build.dir" location="${basedir}/build" />
    <target name="build">
        <echo message="build.dir.base as defined for project=${build.dir.base}" />
        <subant antfile="build.xml" target="build" inheritAll="false" inheritRefs="false">
            <dirset dir="project.base" includes="${module-list}" />
            <property name="build.dir.base" location="${build.dir.base}/${name}" />
        </subant>
    </target>
</project>

And for the projects that have modules:
build.xml (for a module):

<project name="z">
    <property name="build.dir.base" location="build.dir.base" />
        <target name="build">
            <echo message="build.dir.base as defined for module=${build.dir.base}" />
        </target>
</project>

This structure allows projects to be built independently, also modules can be build independently or the whole system can be built using the build-all.xml.
Also, the final product has the folowing structure:

  • ${system.build.base}/P1,
  • ${system.build.base}/P2/M1
  • ${system.build.base}/P2/M2

etc

However, since ant >= 1.8.0 this is not possible any more. The reason is that
<property name="build.dir.base" location="${basedir}/build" /> in build-all.xml
takes precedence over <property name="build.dir.base" location="${build.dir.base}/${name}" /> in build.xml (build for projects). So, the destination of the project “submodules” is in ${system.build.base}/M1 instead of ${system.build.base}/P2/M1

This is explained Properties defined on the command line cannot be overridden by nested elements. Since Ant 1.8.0. the same is true for nested structures of tasks: if a build file A invokes B via an task setting a property with a nested element and B contains an tasks invoking C, C will see the value set in A, even if B used a nested element as well.

There is no way to override a property for subant if some of the parents also defined that property. This is severe, since the build should be aware for properties that the parent used for some unrelated reason.

Is there workaround for this incompatible change in behavior? Since, my build system heavily relies on the fact that <subant inheritAll="false" inheritRefs="false"> will do the exec without polluting the sub-builds.

  • 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-06-01T08:06:13+00:00Added an answer on June 1, 2026 at 8:06 am

    https://issues.apache.org/bugzilla/show_bug.cgi?id=49891 also seems related to this question.

    After trying out many different things (including the technique of filtering out the unwanted property then resetting it), I have concluded that it is impossible to override command-line properties in a subant task.

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

Sidebar

Related Questions

Using Apache Wicket 1.4: I have a panel that calls some setup Javascript in
I am using apache ant to generate javadoc for my project. I have a
I have successfully implemented rest webservice using apache wink. I am using ant to
I have make jar war EAR using ant and Hudson and store all files
Using Apache 2.2 and PHP 5, what's the best way to run PHP without
Currently, I am showing splash screen in my desktop application using the following way
I've got the following build environment : Ubuntu Java 1.6.0_24 Apache ant 1.8.2 Jenkins
I'm using Spring and struts and have the following entry in 'C:/source/webapp/WebContent/META-INF/context.xml' with tokens
I have problems connecting to CVS using ant build.xml. I figured out the reason
I'm using org.apache.tools.ant.listener.Log4jListener to manage logging with my ant script. The ant script is

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.