ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Borremans, Eric" <>
Subject Possible bug discussion - always recompiles
Date Tue, 07 Jan 2003 18:20:22 GMT
Hi all,

I have encountered the "ant always recompiles all my files even unchanged"
issue. Before searching the list I used the verbose mode and noticed that
when ant looked for the .class files in order to compare time stamps with
the .java files, it was looking in the wrong place. I proceeded to change my
srcdir to the root of my sources and used the include="" to specify what
files I wanted to compile. That solved the problem and I just found out, was
the documented solution in this list's archives.

But in my opinion this is a bug in ant's behaviour. Before reporting it as
such, I'm following the bug list advice and talk to users first. Here is why
I think it's a bug.

Take the following structure:

and contains a "package a.b;" clause.

The following lines will compile and put foo.class in /build/a/b,
where it should. But when checking timestamps it will look for foo.class in

<javac srcdir="/source/a/b" destdir="/build">
   <include name="**.java"/>
   <classpath refid="class.path"/>

Most of you know this already, I'm just summarizing.

Changing the build file to

<javac srcdir="/source"    destdir="/build">
   <include name="a/b/*.java"/>
   <classpath refid="class.path"/>

Solves the issue.

According to me, the first build file should work too. If ant knows (agreed
it's technically javac) where to put the file when compiling them, then it
should also know where to look for them when comparing time stamps. Yet it
does not, it resolves the paths differently and ends up looking in a place
where there are no files. This could also lead to tricky issues if classes
with identical names existed in different packages (agreed, bad idea but it
would not be the first one in software development) since it compares file
names only when determining if recompilation is necessary.

My guess is that when ant compares timestamps, it does not look at the
source in the java file and has no knowledge of the package clause,
therefore does not use it in its path logic. On the other hand, javac does
use the packages and writes the files in the proper location.

So the bug is: ant does not properly resolves absolute paths in the process
of determining if a .java file needs to be recompiled.

Does anybody agree with my logic, or am I demanding too much from ant? Or
maybe I just misunderstood how it should work.

Thanks for listening and for any input. Cheers,


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

View raw message