ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Douglas Bitting <Douglas.Bitt...@agilesoft.com>
Subject RE: javac always recompiles all files
Date Mon, 22 Jan 2001 23:35:33 GMT
Chad,

Change:

    <target name="compile" depends="prepare">
       <javac srcdir="com" destdir="${build.dir}/classes" debug="on"
          deprecation="off" optimize="off"/>
    </target>

To:

    <target name="compile" depends="prepare">
       <javac destdir="${build.dir}/classes" debug="on"
          deprecation="off" optimize="off"
          includes="com"/>
    </target>

By setting 'srcdir="com"', you are telling javac that package names should be resolved relative
to "com", which is probably not what you want.
Instead specify 'includes="com"' to tell the javac task to look within the 'com' directory
for source files.

For example, assume you have a file located at "com/foo/bar.java", with a package declaration
of "package com.foo".  When bar.java is compiled, the
compiler will place it within the 'com.foo' package.  However, according to your build.xml,
when the javac task does its dependency sweep, it will be
looking for 'bar' within the package 'foo' (not 'com.foo').  Not finding it, the javac task
will think it needs to be recompiled.

Wow, that explanation sure looks overly complicated to me.  I hope you can make sense of it!
 :-)

Cheers,
--Doug

Mime
View raw message