ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Inger, Matthew" <In...@Synygy.com>
Subject RE: Recursive Ant and Properties
Date Thu, 09 Sep 2004 17:37:34 GMT
Use AntContrib's <var> task to change value of a property that is
already set.

-----Original Message-----
From: Victor Volle [mailto:victor.volle.ml@swissmail.org]
Sent: Thursday, September 09, 2004 9:38 AM
To: 'Ant Users List'
Subject: Recursive Ant and Properties




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

ROOT
 +----A
 |    +-----A1
 |    +-----A2
 |
 +----B
      +-----B1
      +-----B2

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}/common.properties"/>
 3:        <import .../>
 4:
 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 invocation: 

   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: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message