开发者

How do I create a jar distributable for javadocs?

开发者 https://www.devze.com 2023-03-29 15:15 出处:网络
开发者_C百科I\'ve created an API that I release as a JAR file.It\'s proprietary so I had to strip the source files out of it.

开发者_C百科I've created an API that I release as a JAR file. It's proprietary so I had to strip the source files out of it.

I currently include a separate /doc folder which contains the output of Eclipse's export-to-javadoc wizard. Not bad, but I'd like to go one step further.

I'd like to distribute the javadocs as a jar file that can be easily dropped into a future project which includes the jar file for my API. I know I've seen it done this way several times with other distributions I've used, but I haven't had any luck searching.

End goal is to allow future developers to have easy access to hover over comments and things of that nature.

Thanks!


It seems it is enough to package the doc folder containing the eclipse generated documentation as a jar file. Then if you want to use that jar as javadocs of the actual jar containing the compiled .class files, you assign the javadoc jar with the "Javadoc in archive" in Eclipse and set the Path within archive as doc. It seems Eclipse looks for index.html and package-list entries in the doc folder.

How do I create a jar distributable for javadocs?



Also using maven-javadoc-plugin may an easy way to do this. See the link below:

http://www.avajava.com/tutorials/lessons/how-do-i-generate-and-deploy-a-javadoc-jar-file-for-my-project.html


If your end goal is just for the future developers to be able to view your javadoc instructions when they are using your classes or methods, in Eclipse you can have option to export java source files when you export your jar library as shown in the image below:

How do I create a jar distributable for javadocs?

This also allows developers to step in and view your codes while debugging.

0

精彩评论

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

关注公众号