ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viraj Purang <>
Subject RE: Java Dependencies ...
Date Thu, 14 Jun 2001 22:58:49 GMT
   The <Javac> task with the verbose option gave s0ome information but not
good enough to lead me to deuce anything significant.

The directory in question has 6 files and it compiles all 6 while it should
do only one.
    [javac] Compiling 6 source files to C:\CVS1\builder\client\build\classes
    [javac] [parsed
C:\CVS1\builder\client\com\spincircuit\utils\ in 531 ms]
    [javac] [parsed C:\CVS1\builder\client\com\spincircuit\utils\
in 100 ms]
    [javac] [parsed
C:\CVS1\builder\client\com\spincircuit\utils\ in 0 ms]
    [javac] [parsed
C:\CVS1\builder\client\com\spincircuit\utils\ in 71 ms]
    [javac] [parsed
C:\CVS1\builder\client\com\spincircuit\utils\ in 20 ms]
    [javac] [parsed
C:\CVS1\builder\client\com\spincircuit\utils\ in 30 ms]
Which means that all the local files(in the current directory) are being
parsed for compilation 

For all other files it gives me a 
	[javac] [loaded c:\jdk1.3\jre\lib\rt.jar(java/util/Locale.class) in
60 ms]
	[javac] [loaded
c:\jdk1.3\jre\lib\rt.jar(java/util/ResourceBundle.class) in 30
	[javac] [loaded c:\jdk1.3\jre\lib\rt.jar(java/lang/Object.class) in
10 ms]
	[javac] [loaded c:\jdk1.3\jre\lib\rt.jar(java/lang/Exception.class)
in 0 ms]
	[javac] [loaded c:\jdk1.3\jre\lib\rt.jar(java/lang/Throwable.class)
in 0 ms]
and all these LOADED files are external files (outside the directory ...from
the classpath)

Viraj Purang

-----Original Message-----
From: Diane Holt []
Sent: Thursday, June 14, 2001 12:41 PM
Subject: RE: Java Dependencies ...

Well, the page you pointed me to has this to say about using the -Xdepend
  -Xdepend  Recursively search all reachable classes for more recent
            source files to recompile. This option will more reliably
            discover classes that need to be recompiled, but can slow
            down the compilation process drastically.

So, if all it's doing is looking for source-files that are newer than
their classfile counterpart (which is what that says to me -- although I'm
not sure what "reachable classes" means), then I don't see it being useful
when using Ant's <javac> task, since that's what the task itself does.

As for the <depend> task -- my understanding is that if you change a
source-file that other source-files depend on, then running the <depend>
task should remove all those dependents' classfiles, which will cause them
to be handed off to the compiler when you then run the <javac> task (since
the <javac> task will compile any source-file that either a) is newer than
its corresponding classfile, or b) has no corresponding classfile.

As for why all your source compiles every time you run the <javac> task --
if it's doing it even when no source-file has changed, then I'd suggest
running ant with the -verbose flag, which will give you output from
<javac> telling you why it's compiling those files (it tends to be because
it can't find the classfile). If it's doing it when you've changed a
source-file that the whole world depends on, and you're running the
<depend> task first, then it would be because all those classfiles are


--- Viraj Purang <> wrote:
> Hi Diane,
>    It definitely  helped me...
> But I do remember having read in the "javac" description on
> that javac's handling of "The need for recompilation" is not dependable
> and
> -depend option is more desirable to use. eg:
> "By default, javac considers a class file out of date only if it is
> older
> than the source file. (The -Xdepend option specifies a slower but more
> reliable procedure."
> Another clarification is about the javac task itself :  you said 
> "In any case, it isn't used to associate a dependency from the
> classfiles to
> the sourcefiles -- that's done by the <javac> task itself". 
> Do you mean that the functionality is taken care of, by the "javac task
> implementation in ANT" OR 
> comes to Ant intrinsically because "Javac executable which Ant
> implementation from is supposed to handle this  behaviour".
> I have just completed a compilation script using Ant ...and based on
> deductions I make regarding (which files are (re-)compiled and which are
> not) I shall get back to you with more questions...
> I am currently using something like ...
>   <target name="build-main">
>     <depend srcdir="com/spincircuit"
>         destdir="{}/classes"
>         cache="depcache"
>     closure="yes"/>
>     <javac   srcdir="com/spincircuit" destdir="${}/classes"
> depend="on"
> vlet.jar}:${mail.jar}:${jaws.jar}:
> ol}"
>              deprecation="off" debug="on" optimize="off" target="1.2"
>              excludes="**/CVS/**">
>     </javac>
>   </target>
> Can you suggest the expected outcome of this set of statements ?
> Regards,
> Viraj Purang


Do You Yahoo!?
Spot the hottest trends in music, movies, and more.

View raw message