ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Victor Volle <>
Subject Recursive Ant and Properties
Date Thu, 09 Sep 2004 13:38:00 GMT

I have a problem building a big project. The structure is something like 

 |    +-----A1
 |    +-----A2

All projects and subprojects import a common build file. The problem starts when a property
(e.g. "foo") is set in a 
project (e.g. "A") that should have a different value in a subproject ("A1"). 

The build files look like:

 1:    <project ...>
 2:        <property file="${common.dir}/"/>
 3:        <import .../>
 5:        <target name="build">
 6:           <subant inheritall="true" ...>
 7:             ==> X <==
 8:           </subant
 9:           .. do something ..
10:        </target>
11:    </project>
I could now either use subant without inheriting any property. Then I can set "foo" in A1
to another value. But I want 
to inherit some properties and I do not want to have a long explicit list of properties that
must be inherited. 

I would prefer to "inherit" all properties but to be able to change the property in "A1".
But when "returning" to "A" 
the values should not be changed, so best would be a sort "scoped" properties for each subant

   A --- properties-of-A
   |          ^
   |          | 
   |          |
   A1--- properties-of-A1
So if a property is not found in properties-of-A1, properties-of-A should be searched. Setting
of properties should only 
occur in the bottom-most properties. So even if a property "foo" is already defined in properties-of-A
it can be set in 
properties-of-A1. But after it has been defined in A1 it can not be changed anymore as usual.

Perhaps there is a better solution to my problem/requirements? 

I am currently considering of writing my own subant with my own PropertyHelper, but would
prefer a standard solution.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message