开发者

Generate Javadoc for just interfaces using Ant?

开发者 https://www.devze.com 2022-12-29 15:20 出处:网络
I am using Apache Ant to generate Javadoc for my program which has many projects (or modules). However, I want to generate Javadoc for Interfaces only, and I do not know how to check if a file is a cl

I am using Apache Ant to generate Javadoc for my program which has many projects (or modules). However, I want to generate Javadoc for Interfaces only, and I do not know how to check if a file is a class or interface in Ant. Someone suggested me that I should use <fileset> and specify a list of files to exclude or include. However, there are hundreds of files in my program and specifying a list of class files to exclude is impossible.

Does anyone ha开发者_运维知识库ve some ideas, please?


I don't believe this is possible unless you write your own custom ant-task, (which wouldn't be that hard actually) and reference that in your Ant-script.

Another, (much uglier) way would be to generate the complete java-doc and remove non-interface files. These could for instance be identified by looking at the allclasses-frame.html:

<A HREF="javax/swing/text/ComponentView.html" title="class in javax.swing.text" target="classFrame">ComponentView</A>
<A HREF="java/awt/Composite.html" title="interface in java.awt" target="classFrame"><I>Composite</I></A>

where you have both the type (in the title=...) and file (href=...) available.


Have you considered writing your own doclet? Instead of trying to get ant to do the work, create a doclet that knows how to discard every non-interface. Then, using the javadoc task in ant is simple.

Hope that helps.

0

精彩评论

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