Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a jar distributable for javadocs?

Tags:

java

jar

javadoc

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!

like image 201
Batman0730 Avatar asked Aug 19 '11 19:08

Batman0730


1 Answers

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.

Setting Javadoc location in Eclipse

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

like image 64
suat Avatar answered Sep 26 '22 21:09

suat