You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Stefan Bodewig <bo...@apache.org> on 2000/12/01 09:46:52 UTC

Re: How to share same properties in build.xml

Evan Yang <EY...@digitalboardwalk.com> 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
<http://marc.theaimsgroup.com/?l=ant-user&m=97358675517672&w=2> 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 ?

No. 

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

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

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

Stefan