You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Leif Mortenson <le...@silveregg.co.jp> on 2001/08/21 05:30:29 UTC

How to handle conflicting properties in nested build files.

We have several projects which we would like to be able to build as one
large project.
This can easily be accomplished by using the ant task to call the
build.xml files of the individual sub projects.

The problem that we are having is that the main project defines a property
		<property name="bin.dir" value="${basedir}/bin"/>
Then the sub projects do the same. The sub projects build fine when ant
is run on them as standalone builds, but when their builds are spawned
using the ant task, the attempt to set the bin.dir property in the sub
project is ignored as the property has already been set.

		Override ignored for bin.dir

This results in build targets being placed in the wrong directories.

I can think of a few workarounds to make this all work, but I was
wondering what the recommended method for handling situations like this
is for Ant.

Thanks in advance,
Leif



Re: How to handle conflicting properties in nested build files.

Posted by Mikko Kurki-Suonio <ma...@davisor.com>.
On Tue, 21 Aug 2001, Leif Mortenson wrote:

> The problem that we are having is that the main project defines a property
> 		<property name="bin.dir" value="${basedir}/bin"/>
> Then the sub projects do the same. The sub projects build fine when ant
> is run on them as standalone builds, but when their builds are spawned
> using the ant task, the attempt to set the bin.dir property in the sub
> project is ignored as the property has already been set.
> 
> 		Override ignored for bin.dir
> 
> This results in build targets being placed in the wrong directories.

> I can think of a few workarounds to make this all work, but I was
> wondering what the recommended method for handling situations like this
> is for Ant.

Don't know about recommended, but I eventually used semi-unique prefixes
to separate namespaces.

Ant2 is supposed to(?) have better namespace separation.

However, you CAN override property values in the <ant> tag itself, using
nested <property> tags. The easiest way to do this is probably something
like this:
 
 <ant antfile="subproject" target="blahblah...">
  <property file="subproject.properties" />
 </ant>


//Mikko