ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: How to share same properties in build.xml
Date Fri, 01 Dec 2000 08:46:52 GMT
Evan Yang <> wrote:

> I have a bunch components, each has their own build.xml.
> They all share some common properties.
> So I like to have a global build.xml contains common properties.
> Evan more the common task can be there too.
> So how to include this global build.xml in the local build.xml ?

Use SYSTEM entities to let the parser include an XML snippet, see
<> for
the text that would be in the FAQ if it had been approved.

> And one more question, how to overwrite a property/target in local
> if possible ?

You can't have two targets with the same name - I guess this is what
you mean with overwriting targets. 

And right now there is no way to overwrite a property with <property>
(this might change in Ant 2.0 which still hasn't left the
specification stage - actually not really entered it), you can do it
with a task of your own - <property>'s implementation does an explicit
check to make sure it doesn't overwrite an existing property that your
own task could omit.

> I notice when I use task ant to make recursive build, the same
> property can't be overwritten.  Is that a feature ?

Yes, at least a feature of Ant 1.x.

> Can I overwrite the properties in local build, then restore the
> value back to global one ?


Again, both answers only apply to changing them via
<property>. Something like

<script language="javascript">
    project.setProperty("name", "value");

should work, as well as its Java equivalent in a custom task.


View raw message