ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject filesets referenced by <javac>'s <src> element
Date Tue, 28 Aug 2001 04:13:57 GMT
I've been using things like the following [ant v1.4beta2]:

<javac destdir="..." >
        <src refid="idA" />
        <classpath refid="idB" />

where if "idA" points to something like

<!-- option A -->
<path id="idA" >
    <fileset dir="${core.src.dir}" >
      <include name="**/*.java" />
      <exclude name="**/*.html" />
      ... and so on ...

then <javac> barfs with a message that some file in my ${core.src.dir} is 
not a directory [the first file it finds during a recursive directory 
traversal, it appears]. Obviously, it tries to recurse into that file and 
that does not work, of course.

However, if I change my idA path such that it contains no nested 
<fileset>'s and only straightforward path elements, like:

<!-- option B -->
<path id="idA" >
    <pathelement path="${core.src.dir}" />

then it works. This forces me to move my includes and excludes into the 
<javac> task itself, while I 'd rather group my inclusion/exclusion 
patterns together with my path strucutres and reference it through a 
refid. After all, I'd like to think about my <javac> operatin on a fileset 
and I'd like to form such filesets elsewhere so I could re-use them 
throughout the file.

I don't understand why the option A does not work. According to <javac> 
documentation, "srcdir" is a path-like structure and is settable via 
nested <src> elements. This is what I am doing in both cases. Also, per 
documentation path-like structures are allowed to contain nested <fileset> 
elements, which is what I am doing in option A. Yet it does not work -- 
could someone explain why?

It appears to me that I should change my way of thinking: instead of 
<javac> being a target working with 2 filesets (srcdir, classpath, and 
bootclasspath) I am supposed to think of it as a source fileset (srcdir) 
that works with other filesets (classpath and bootclasspath). I don't 
quite see why the latter would be more logical.

Thanks in advance,
View raw message