Problems with FileSet in Ant script?

I am using an Ant script to generate javadoc and I just just wnt Ant looking for some classes based on a certain template, 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>                       

      

This means that I only want Ant to look for the source file that starts with "ABC" and generate javadoc for those files. However, the results are duplicated for each file starting with "ABC".

Did I do something wrong?

thanks

+2


a source to share


3 answers


The problem comes from the use of the attribute sourcepath

and nested tag fileset

. If you cancel sourcepath

and just get it fileset

, you should be fine. that is, 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>   

      

+3


a source


You cannot use complex file templates in a task javadoc

.

The javadoc for the Ant class javadoc

mentions this as a limitation:

== Start quote ===



Known Limitations:

  • templates must be of the form "xxx. *", every other template does not work.

  • ...

== End quote ===

+1


a source


You can try with nested include

inside a set of files, not filename

like

<include name="**/ABC*"/>

      

or use packagenames attribute in javadoc tag like

 <javadoc packagenames="*.abc*"

      

0


a source







All Articles