ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: new ant user : exclude files
Date Wed, 22 Nov 2000 12:14:44 GMT
Robert Davies <Robert.Davies@astro.cf.ac.uk> wrote:

> I am a new user to ant and would appreciate any help anybody could
> give. I am trying to exclude the files in the directory
> ./toolkit/tmp/*.java from compilation. I have tried the exclude tag
> but I cannot get it to work.

[...]

> <javac srcdir="./util:./gui:./toolkit:" destdir="../../classes" 
>        deprecation="on" optimize="on"> 
>   <exclude name="./toolkit/tmp/*.java" /> 
> </javac>

it doesn't work because the files in ./toolkit/tmp don't match the
pattern you specify. Patterns are relative to a base directory, so
what you are actually excluding here is

./util/./toolkit/tmp/*.java
./gui/./toolkit/tmp/*.java
./toolkit/./toolkit/tmp/*.java

make your exclude pattern tmp/*.java and it should work (but also
exclude util/tmp/*.java and gui/tmp/*.java if present).

Three notes:

(1) You don't need to prefix your relative filenames with ./ this is
what Ant (1.2) assumes anyway.

(2) If a class you are going to compile references another class that
lives in toolkit/tmp/, this one will be compiled as well, even though
you've ordered to exclude it.

(3) <javac> expects to be pointed to the root of a package hierarchy,
so the files living directly in the toolkit, util or gui directories
are expected to be in the (unnamed) default package. No big harm will
be done if you don't obey to this rule, except that Ant will always
recompile all files.

Stefan

Mime
View raw message