views:

687

answers:

2

I've looked at a bunch of different examples, and tried several variations, but can't seem to get this working correctly. It also appears that you can't exclude an entire directory with javac, but only files, which I suppose means you can't specify a package? Here is what I have:

<javac srcdir="src" destdir="WEB-INF/classes" excludes="path/to/excluded/package/*.java">
    <classpath refid="compile.classpath"/> <!-- reference defined earlier -->
</javac>
+2  A: 

You can exclude whole directories or directory trees with "**" and exclude. Example

<dirset dir="aDirectory">
    <include name="a/package/**"/>
    <exclude name="**/package/to/exclude**"/>
</dirset>
akr
Nested dirset does not work with the javac task.
hal10001
Right, but as part of a classpath that is references in the javac task they should work.
akr
A: 

Be careful with this. javac has been known in the past to not exactly respect this kind of thing if it determines that it needs one of the source files that you are trying to exclude.