ant fileset dir exclude certain directory

2019-03-18 00:34发布

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.

标签: ant
1条回答
Ridiculous、
2楼-- · 2019-03-18 01:28

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/**.

查看更多
登录 后发表回答