ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diane Holt <>
Subject Re: how to supplement javac compile dependencies?
Date Fri, 20 Oct 2000 19:23:06 GMT
There are a couple of options... 

If you know you've changed something that would require dependent files be
recompiled (eg., changed an interface), you can do a "clean" then a
"compile", which will just recompile everything.

If you only have a few files you need this done for, you might try using
the <uptodate> task, which allows you to associate a dependency between a
"target" file and "source" files. 

The problem with using the dependency-checking mechanisms of the Java
compilers themselves is, as I now understand it, you can't only hand off
to the compiler the big kahuna that changed and expect the compiler to go
find all the little fishes that depend on it.

Hope this helps,
--- Bob Price <> wrote:
> I just joined the list, and couldn't find an archive with prior data or
> get the FAQ link on the site to work, so I'll ask a question that
> probably has been asked many times.  If so, and you can point me to
> prior answers that would be great.
> My question is, how can I supplement the dependency checking that the
> 'javac' task does?  It obviously compares the timestamp between the java
> file and the compiled class file and recompiles if the java file is
> newer.  But, this is not enough in some cases.
> For example, in a package with lots of java files that have already been
> compiled, if I change one file in an incompatible way then recompile
> using ant, then it only compiles the file that changed, but then the
> other compiled classes will be unchanged but will not work since I broke
> something that should have been caught at compile time.  It would be
> wonderful if ant could figure this out and recompile all effected
> classes.  But short of that, is there a mechanism where I can say that
> these java files depend upon this other one (like in makefiles), thereby
> forcing ant to recompile the other files?
> Is the only way to do this to write my own task that checks these
> dependencies and deletes the generated class files before calling
> 'javac' thereby making it recompile?
> Thanks for any help!
> Bob


Do You Yahoo!?
Yahoo! Messenger - Talk while you surf!  It's FREE.

View raw message