Pergunta

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

Foi útil?

Solução

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>   

Outras dicas

You cannot use complex file-patterns in the javadoc task.

The javadoc for the Ant Javadoc class mentions this as a limitation:

==Begin Quote===

Current known limitations are:

  • patterns must be of the form "xxx.*", every other pattern doesn't work.

  • ...

==End Quote===

Can you try with a nested include inside fileset, instead of filename like

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

or use the packagenames attribute within javadoc tag as

 <javadoc packagenames="*.abc*"
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top