开发者

Generate html documents for compiled classes

开发者 https://www.devze.com 2022-12-21 07:37 出处:网络
I have a java compiled library in a jar.for which i have written documentation in source code.There is one more tool which generates the jar ,it included only those classes which are required for targ

I have a java compiled library in a jar.for which i have written documentation in source code.There is one more tool which generates the jar ,it included only those classes which are required for target project.I have huge projects which make use of this jar,and only those classes should 开发者_如何学Cgo in the target project. Now the problem I want to give documentation for the classes.is it possible to generate documentation from the compiled classes?


No. The documentation (javadoc) is generated from the source (.java) files. All the comments/javadocs are lost after compilation.

The users of the library will only be able to use the autocomplete of their IDEs as some sort of documentation.

I can't see your script, but I assume you could apply the same logic to the generation of the javadoc as the one generating the jars.


There is no simple way to do what you want, but you could try the following approach:

  1. Extract the names of all .class files in your JAR, filtering out any with $ in their name and mapping the remainder to the original .java file names.

  2. Create a temporary directory tree containing copies of all of the .java files selected above.

  3. Run the javadoc command using the about tree as the sourcepath.

If you don't have too many files, you could skip the step of creating a directory tree and run the javadoc command with all .java file names as command arguments.

Either way, you will have some non-trivial scripting ... or equivalent Java ... to implement.


I suppose you should filter the comments of classes required for target projects, separately and combine with the sub-jar being created.

0

精彩评论

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