开发者

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 start开发者_如何学运维s 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


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>   


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*"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜