ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ventimiglia, David" <>
Subject RE: newbie question
Date Wed, 15 Nov 2000 20:49:05 GMT

One suggestion would be to have a property named "package.dir" which you use
in <include> elements within, say, <javac>.  Set package.dir to the empty
string in the build.xml file, so that it produces no additional filtering
effect in the <javac> task.  However, if the user overrides this property
from the command line, using -D, it will cause the <include> element to
filter down to just the package you need.  This gives you flexibility in
that you can choose the root under which everthing is built, and it doesn't
require adding much to the build.xml file.  The drawback is that it still
uses a recursive directory scanning approach under the new root, so you can
only achieve relatively simple filtering.  The build file would look
something like this:

<property name="src.dir" value="src"/>
<property name="build.dir" value="classes"/>
<property name="package.dir" value=""/>
<task name="classes">
  <javac srcdir="src.dir"

Using this, "ant classes" will build everything under src.  "ant
-Dpackage.dir=com/foo/bar/taglibs" will build everything under


-----Original Message-----
From: Dean Holdren []
Sent: Wednesday, November 15, 2000 12:15 PM
Subject: newbie question

Hi, I have just started using ant, and I am very interested in it.  I just
have one general question, maybe it's too broad.
If I run ant.bat from the location of the build.xml, it will (attempt) to
build the entire project.  How would I go about allowing for sectional
compiles, i.e. just certain (sub)packages?  Currently we use makefiles, each
directory has a makfile in it which contains references to the immediate
child directories and the TOPDIR (if 4 levels down, ../../../..).  This way
we can call make from any point in the directory/package tree and it will
compile everything in the current dir and everything below it.

How would I go about doing this in ant?  Would I have to have build.xml
files for every directory in the directory tree?

Dean Holdren
Timecruiser Computing Corp.
(973)244-7856 x154

View raw message