antfileset

Problems with FileSet in Ant script?


I am using Ant script to generate javadoc and I just only wnt Ant to look for some classes based on a certain pattern, so I wrote:

<javadoc access="public" source="1.6" sourcepath="src" destdir="dest" >

<fileset dir="src" casesensitive="yes" defaultexcludes="yes">
        <filename name="**/ABC*.java"/>
</fileset>

</javadoc>                       

That means I only want Ant to look for source file that starts with "ABC" only and generate javadoc for these files. However, the results are awayls duplicate for each file starting with "ABC".

Did I do something wrong?

Thanks


Solution

  • The problem comes in from using both the sourcepath attribute and the nested fileset tag. If you scrap the sourcepath and just have the fileset, you ought to be fine. i.e., instead of

    <javadoc access="public" source="1.6" sourcepath="src" destdir="dest" >
    <fileset dir="src" casesensitive="yes" defaultexcludes="yes">
        <filename name="**/ABC*.java"/>
    </fileset>
    </javadoc>
    

    just do:

    <javadoc access="public" source="1.6" destdir="dest" >
    <fileset dir="src" casesensitive="yes" defaultexcludes="yes">
        <filename name="**/ABC*.java"/>
    </fileset>
    </javadoc>