ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: how many build.xml files and where should they go?
Date Mon, 07 Apr 2003 18:11:55 GMT
The canonical setup of an Ant build for a decent size Java project is a
single build.xml at the root of the project. A simple rule of thumb is that
you should have one build file per src/ directory (containing production
code. Testcases, aspects, and other kind of sources, if living in a separate
source dir, do not count for this rule).

Maybe J2EE projects need more than one build.xml files, as David suggests
though... I don't have experience in this area, so I won't comment.

I'd advise you to start with a single build.xml, and later refactor into
several build files if the need really arises. --DD

-----Original Message-----
From: David McTavish [] 
Sent: Monday, April 07, 2003 12:55 PM
To: 'Ant Users List'
Subject: RE: how many build.xml files and where should they go?

I prefer many build.xml files throughout the source tree, with a single
build file at the parent to unite them all. Allows flexibility, without
cluttering the parent build script. You'll notice that most projects have
very similar patterns, that you can refactor out to a library of build
files, but most projects have at least one or two quirks about them (whether
they be ejb's, jsp precompilation, etc. etc.). I found that having them all
in a single script was very unwieldly and difficult to manage, and pushing
all of the customizations to each sub-directory has greatly helped for
management of the scripts. (However, I would make sure that you constantly
manage the distributed build scripts to ensure that you refactor as much as


-----Original Message-----
From: Tim Singletary []
Sent: Monday, April 07, 2003 1:44 PM
Subject: how many build.xml files and where should they go?

I haven't seen much discussion about this question, but there seem to
be two very different approaches to managing build.xml files.

One approach has a single build.xml at the top of the project tree.

The other approach has many build.xml files, one in each subdirectory
in the src tree.

Why should I choose one approach over the other?  Is either approach
generally preferred?


View raw message