ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wildish, Joe STASCO-OTO/72" <Joe.Wild...@shell.com>
Subject Javac: multiple source roots & filesets
Date Wed, 26 Apr 2006 09:08:44 GMT
All,

New to the list, not new to ANT. Am using v1.6.5. I've had a scan through the archives of
this list but I can't find an answer to my question.. so here goes: I have two source roots,
root_a and root_b. Beneath those directories are some source files, some of which are for
the same class. e.g.

root_a/package/One.java
root_a/package/Two.java
root_b/package/Two.java
root_b/package/Three.java

I want to compile up the source files of my choosing, without copying files around to temporary
areas (I can achieve what I want via copy, but I should be able to do it just via javac).
Let's say that I want to choose "package.Two" from the root_b directory; if this was command
line, I could do the following:

$ mkdir classes
$ javac -d classes root_a/package/One.java root_b/package/Two.java root_b/package/Three.java

... and it would work fine. However, I can't seem to replicate this in an ANT target. As filesets
are relative to the specificed directory, I cannot find a way to exclude certain files from
one source root, as effectively I am working within the same namespace.

What I really want to do is something like this:

<javac destdir="classes">
    <src>
        <fileset dir="root_a">
            <include name="**/*.java"/>
            <exclude name="package/Two.java"/>
        </fileset>
        <fileset dir="root_b">
            <include name="**/*.java"/>
        </fileset>
    </src>
</javac>

However, the src attribute of javac is only looking for directories (to then recursively scan),
so that does not work. Any help would be appreciated.

Regards,
Joe

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message