ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Mukhar <kevin.muk...@corp.usa.net>
Subject Re: Ant/javac
Date Wed, 24 Jan 2001 22:28:47 GMT
Tina Armstrong wrote:
> 
> however, it re-compiles everything everytime, and I thought that the following should
apply:
> The source and destination directory will be recursively scanned for Java source files
to compile. 

Here's the answer from Douglas Bitting <Douglas.Bitting@agilesoft.com>
Subject: RE: javac always recompiles all files
Date: Mon, 22 Jan 2001 15:35:33 -0800

> 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!  :-)
>

Mime
View raw message