ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chad Loder <>
Subject Ant <project> extension, templatized build files
Date Tue, 30 Apr 2002 19:38:10 GMT
Hello. I am fairly new to ant, so please forgive me
if this is an issue that's already been discussed
(I did search the user and dev archives).

We have a very large build system (currently
implemented in GNU make) consisting of several
subprojects. There is a high degree of redundancy
in the subproject makefiles (e.g. identical definitions
of "clean" targets, the only variation being different
values for some variables). I would like to eliminate
this "cookie cutter" redundancy using ant.

I would like to have one ant file "extend" another.
I'd like to write a generic "project" template file, and
then allow other build.xml files to extend it, overriding
targets and properties as they see fit.  If no override
is supplied, the target definition from the "parent" build
file would be used.

 From my brief perusal of, it looks like
this wouldn't be too hard to accomplish by adding
something like:

	private Project template;

and then use this variable as a "last resort" for
obtaining properties/task/references definitions not
found in the "child" object.

The syntax might look something like:

<project name="r7" default="build" basedir="." extends="projtmpl.xml">

Is this an idea that has been broached before? Does it sound
like a good idea, bad idea? Any obvious complications I might be

 From my limited experience with ant, I see that properties are inherited
by <ant> tasks, but task definitions (and other things) are not? Is this
true, and will it be true in the future?

	Chad Loder

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message