ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Balazic <>
Subject Make ant (much) faster ?
Date Thu, 17 Jul 2003 16:24:51 GMT
( this is being sent by M$ Exchange client v5.0 ;
no known way to switch to plain text messages. If anyone
knowns one, please tell ! )


I came from C/Makefile background and joined recently a java project, that
uses ant for the
buil environment.

There are a few problems :

 - (first:) ant does too much work, when it is not needed

 We have several targets for ant :
    - rebuild
         <target name="rebuild" depends="clean, build" description="Rebuild
        this deletes all built files and build them from scratch

    - build
   <target name="build" depends="jar, jar-test" description="Build all"/>

    - jar
    <target name="jar" description="Build all jar files"
            depends="jar-a, jar-b, jar-xyz">

    -  jar-b
    <target name="jar-b" depends="compile, write-build-id-txt">

    - ... and many more dependent targets

 The problems is , that if we do "ant rebuild" and the immediatelly after it
 "ant build" , it will build new almost everything. With "make" on my
  projects, it would notice that everything is up to date and do ( almost )
  nothing. Is there anything to that can be done to improve this ?
  Note that this is not only about compiling, but also copying, packaging to
  running scripts to dynamically generate code, etc ...

 - (second:) a subproblem of the first problem
   the actual compile target compiles every source file, not just updated
   This is related to that FAQ question. We have the source files in a
   tree layout that the package hierarchy. Changing the dir structure in the
   middle of the project is not an option. Is there any other solution ?
   Currently we try this : 
     - copy new files to temp dir with the "correct" directory layout
               <copy todir="${generated.src.dir}/${build.pkg.basedir}"
              preservelastmodified="true" overwrite="false">
     - compile them there
         <javac srcdir="${generated.src.dir}" ...

   Not the best solution, but it works. Most of the time. Instead of
   all 500 java source files, it "just" rebuilds 150 of them. All this for a
   changed java source file, or not even that. It rebuilds 150 files, even
if no
   change was done to the project.

 - (third:) bad (no) dependency check
   If I build the project, then change one java source file and call "ant
   it will not rebuild other files that use and therefore depend on the file
I just
   changed. This problem might be caused by our "solution" to the second

All this causes many problem with the project, like :

 - developers make changes that appear to work correctly with "ant build",
   they fail with "ant rebuild" the next day and then nobody knows what
   the problem.

 - developers start using "ant rebuild", because the former makes "ant
   useless. But as a full rebuild takes too much time for a one line change
   in the sources, people start compiling stuff by hand, which again leads
   the problem "rebuild fails, nobody knows why"

It appears that we would be better of without ant.

As I am a complete ant newbie, I can't tell if the cause of our trouble is
our build.xml file sucks, or that ant is not the tool that we need.

Please advise !

David Balazic            
HERMES Softlab       
Zolajeva 30                          Phone: +386 2 450 8851 
SI-2000 Maribor
"Be excellent to each other." -
Bill S. Preston, Esq. & "Ted" Theodore Logan

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

View raw message