ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Singletary <>
Subject Scaling to large projects
Date Mon, 03 Feb 2003 17:54:28 GMT
I can't figure how to set up Ant so that it will scale to be usable
on a large project.  Is there an 'Ant-way-of-doing-things' that I haven't
grokked yet?

For example, suppose my source files are


And packages are as you'd expect.

Initially, I could try a com/x/app/build.xml like:

    <project name="" default="compile" basedir="../..">
      <target name="compile">
        <javac srcdir="." destdir=".">
          <include name="com/x/app/*.java"/>
          <include name="com/x/util/*.java"/>

(Question: is this a reasonable build.xml?  Should it be in com/x/app,
or would you keep it somewhere else?  Would you use a different
project name, a different basedir, would you do the javac element
differently, etc.?)

One scaling problem is that I might not want to compile everything in
com/x/util - perhaps the still-being-developed
doesn't compile.  I could change the javac element to:

        <javac srcdir="." destdir=".">
          <include name="com/x/app/">
          <include name="com/x/util/">
          <include name="com/x/util/">

but it's obvious that this direction of changes won't scale - suppose
com/x/util gets refactored to require com/x/util/, etc.;
I don't want com/x/app to have to know the details of how com/x/util
is structured.

I could try using XML entities - after all, com/x/util is the best
place to keep the list of files I need to include - I might create

    <include name="com/x/util/">
    <include name="com/x/util/">
and change com/x/app/build.xml to:

    <?xml version="1.0"?>
    <!DOCTYPE project [
      <!ENTITY com.x.util.includes SYSTEM "file:../util/includes.xml">
    <project name="" default="compile" basedir="../..">
      <target name="compile">
        <javac srcdir="." destdir=".">
          <include name="com/x/app/"/>

But com/x/util/includes.xml might itself use entities that
com/x/app/build.xml hasn't defined.  (XML's parameter entities might
provide a solution)

Or, stuff in com/x/util might be machine generated and thus might
impose dependancies on com/x/app's build.xml's compile target.

What's the Ant way of solving these kinds of problems?


View raw message