ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Building a hierarcical build-file tree?
Date Tue, 17 Oct 2000 15:44:35 GMT
Dino Valente wrote:

> At 04:31 PM 10/17/00 +0200, you wrote:
> > >>>>> "s" == schmitt  <> writes:
> >
> >  s> Is this possible and if, how?
> >
> >It is possible (calling buildX.xml from control.xml via <ant> for
> >example) but I wouldn't recommend a design like this. IMHO building
> >different modules by different targets in the same build file works
> >better.
> >
> >Stefan
> It is not easy and ant is not geared towards this (which is a shame). I
> disagree with the above premise that different targets in the same build
> file works better. Actually, this is not true since the build files can't
> be reused and can't be called by other build files easily (problem with
> SYSTEM includes and property values).
> A typical development environment would pull in different reusable
> components and would call the standard build files associated with each
> module. At our company we have 20 or so reusable components and using
> makefiles is extremely straight forward (I wish I could use Ant because it
> is nicer and simpler to use but the limitations above prevent me from doing
> this).

The build environment for Tomcat 4.0 (CVS module "jakarta-tomcat-4.0") uses the
hierarchical approach, rather than one big build file.  The reasoning was that
we wanted to be able to build the subprojects completely independently from
each other (by building from the top-level directory of each subproject), yet
have a "one stop shopping" way to build the entire thing available also.

The most intricate part of the design is getting the environmental properties
correct, because they propogate downwards.  It's typical in our build scripts
to use relative directory references like this:

    <property name="servletapi.home" value="../jakarta-servletapi"/>

in a top-level build script to access resources from a "parallel" project tree
-- but this value is passed unmodified down to lower level scripts.  The
workaround was to use Ant's "basedir" variable to convert this reference to

    <property name="servletapi.home" value="${basedir}/../jakarta-servletapi"/>

which will pass the absolute pathname to this project down the tree.  This
works fine -- at least until Ant changes the rules on property immutability
again :-).

> dino

Craig McClanahan

See you at ApacheCon Europe <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message