views:

1729

answers:

2

I use javadoc to document my classes and methods. I would like to add some overview information to my packages, too. I like how Eclipse creates a stub of a matching Doc Comment for each class or method once I type /**<Enter>. Does Eclipse have an easy way to generate a package.html file, too?

+7  A: 

There is no template or wizard to easily create a package.html file.

As mmyers said in his comment, since Java1.5, the correct file to create would be package-info.java.
That file can be used not only for javadocs, but also for package-level annotations (as illustrated here).

There is an opened Bug (#86168) for demanding a wizard for the creation of package-info.java (since the class wizard does not allow the package-info name).

The reflections on that topic are on since... 2005! The problem is that any solution should be implemented in a way that it also helps with 1.4 code.

The current workaround is to create a package-info.java as a text file.
From that point forward, package-info.java behaves as a normal Java class, and Eclipse places a package-info.class file in the output folder.
The Javadocs are correctly built using package-info.java, and not the package.html file.

alt text


Note (in response to Strawberry's comment):

both wish a preview of the package overview in package-info.java in the Javadoc view.

So far, no patch has been proposed/implemented.
There is simply not enough demands for that feature to be added.

VonC
Is there anyway to get the package javadocs to show in the Javadoc fast view window - as they do for classes, interfaces and methods?
Strawberry
@Strawberry: nope, no Javadoc view for package-info.java. See my extended answer on that.
VonC
+2  A: 

There's a plugin that seems to create package.html files. I haven't used it but someone landing here might find it useful.

http://sourceforge.net/projects/package-javadoc/

gmale