Recursive Ant and Properties
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Victor_Volle
Posted On:   Wednesday, September 8, 2004 06:51 AM

Hi! 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"). 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 expl   More>>

Hi!



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").



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.



Regards
Victor

   <<Less

Re: Recursive Ant and Properties

Posted By:   Anonymous  
Posted On:   Thursday, September 9, 2004 03:19 AM

Define the properties in property files. Then take care about the order:

ROOT (common.xml, common.properties, build.xml{subant})
+----A
| +-----A1 (build.xml)
| +-----A2 (build.xml, build.properties)
|
+----B
+-----B1
+-----B2

*/build.xml:





common.xml:


...


So you load your individual properties before importing the common buildfile which loads the common props. Because the immutability of properties you should get what you want. Maybe you cant specify the path to the common prop not as simple as above. You´ll have to look ... and ... I havent tested that - just thoughts :-)
About | Sitemap | Contact