creating javadoc with ant for only the dependent classes of a given class (java file)
I want to create javadoc with ant from a java source file and just from the dependent classes of this file. These are in a java project, but i don't need javadoc from all the java files. Is there a way to create javadoc like javac
javac includes="package/Java_source.java" destdir="dir/classes"
that compiles the source files and just the dependent 开发者_如何学JAVAclasses? If there isn't, then is there another way?
Thanks, Tamas
Well you can add a fileset and / or a packageset parameter:
Example with a fileset:
<javadoc
destdir="docs/api"
author="true"
version="true"
use="true"
windowtitle="Test API">
<fileset dir="src">
<include name="foo/bar/BaseClass.java"/>
<include name="foo/bar/baz/DependentClassA.java"/>
<include name="foo/bar/phleem/DependentClassB.java"/>
</filset>
</javadoc>
But you will have to figure out the dependent classes yourself, I'm afraid.
Reference:
- Ant javadoc Task
There is no way to find out what the "dependent classes" are without starting the job. The only thing I can think of is a brutal hack:
On the compiled classes, use a byte code analysis tool like ASM and check all classes in the code base for their usage of your given class (source code analyis is not enough because of possible wildcard imports and same-package usage). From the List of used classes, build a list of source files, and pass that to the Javadoc task (probably best to create an Ant task that does all this). But this is heavy stuff.
精彩评论