Bruno Nardini
Bruno Nardini

Reputation: 461

How to auto-generate the *-javadoc.jar in Eclipse?

I created the javadocs in my Eclipse Project with the Export >> Java >> Java-doc. The directory structure is MyProject >> docs >> javadoc. I have two questions:

  1. How can I generate the javadoc automactilly with the Eclipse Build?
  2. How can I generate the javadoc automactilly with pattner MyProject-javadoc.jar with Eclipse Build?

The second question is the more important, because I know how generate manually the javadoc, but I don't know how to create the *-javadoc.jar.

Upvotes: 3

Views: 3697

Answers (1)

tenorsax
tenorsax

Reputation: 21223

When you configure Javadoc generation using wizard invoked from Project->Generate Javadoc... you have an option to generate ant script for your settings. You can then invoke (or copy to) the generated ant target from your main build script.

To generate the archive itself you can simply package the folder with generated documentation as a jar file. Add something similar to the following target to your ant scripts:

<target depends="javadoc" description="build javadoc jar" name="package-docs">
    <jar compress="true" destfile="javadoc.jar" basedir="doc" />
</target>

Upvotes: 7

Related Questions