1

I have a list of class files to be excluded and i have added them in a file (say) exclude_class.txt as :

**/a/b/c/*.class
**/d/e/f/*.class
**/g/h/i/j/*.class
**/k/l/*.class

Now when I use excludesfile in fileset task it is not working:

<fileset dir=".">
    <include name="A/**/*.class"/>
    <include name="B/**/*.class:/>
    <excludesfile name="exclude_class.txt"/>
</fileset>

Please let me know what is the issue here. What should be the syntax of file to use in excludesfile task.

kenorb
  • 155,785
  • 88
  • 678
  • 743

1 Answers1

2

excludesfile (and also excludes, includes, includesfile) is an attribute of <fileset> and not a nested tag. you may use it like this:

<fileset dir="." excludesfile="exclude_class.txt">
    <include name="A/**/*.class"/>
    <include name="B/**/*.class:/>
</fileset>  

on the other hand, <include>, <exclude> are nested tags and may be used in the manner in which you've written.

as for the syntax within exclude_class.txt.. just make sure that there are no leading / trailing spaces in each line.

sunbabaphu
  • 1,473
  • 1
  • 10
  • 15
  • Thanks 'sunbabaphu' this worked for me. Can i use a comma separated list of files in excludesflie task? – user3795760 Jul 17 '14 at 19:02
  • No. it says *each line of this file is taken to be an exclude pattern.* on this page: https://ant.apache.org/manual/Types/fileset.html .. so no commas, just line-breaks! – sunbabaphu Jul 17 '14 at 19:03
  • No i mean excludesfile="file1.txt,file2.txt" is this supported? or do i need to add one more fileset task? – user3795760 Jul 17 '14 at 19:19
  • the doc. @ https://ant.apache.org/manual/Types/fileset.html mentions **"the name of a file"**, so probably 1 file, but go ahead and try. maybe, it'll work – sunbabaphu Jul 17 '14 at 19:56