user1164061
user1164061

Reputation: 4352

ant fileset dir exclude certain directory

There are many questions on this topic but none of the answers are solving my problem. Starting this thread again to get fresh input.

I tried two different approaches for excluding B-dir and all its contents under A-dir/subdir. But none work. FYI, a-dir is under dir.src 1)

  <copy todir="${dir.classes}" excludes="A-dir/**/B-dir/**">
  <fileset dir="${dir.src}" >
    <exclude name="**/*.java"/>
  </fileset>
  </copy>

2)

  <copy todir="${dir.classes}">
  <fileset dir="${dir.src}" >
    <exclude name="**/*.java"/>
    <exclude name="A-dir/**/B-dir/**"/>
  </fileset>
  </copy>

I tried deleting all old jars and do a clean compile like someone suggested. But that doesn't help either.

Upvotes: 22

Views: 30996

Answers (1)

Tim Pote
Tim Pote

Reputation: 28059

I think it should probably be:

<copy todir="${dir.classes}">
<fileset dir="${dir.src}" >
  <exclude name="**/*.java"/>
  <exclude name="**/A-dir/**/B-dir/**"/>
</fileset>
</copy>

Note the **/A-dir/** instead of A-dir/**.

Upvotes: 33

Related Questions