Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javadoc for package-info.java only

I have a situation where I'd like to execute javadoc in a project that has no classes. It only has package-info.java for one package. When executing javadoc, the following error is given:

An error has occurred in JavaDocs report generation:Exit code: 1 - javadoc: error - No public or protected classes found to document.

Is there any way to force it to process package-info.java only (aside from the obvious hacky solutions: creating a dummy class, scripting the copying of a package.html, etc.)?

I'm executing javadoc as part of a maven build, so the maven-javadoc-plugin is performing the actual javadoc command.

like image 706
StevenC Avatar asked Feb 04 '23 10:02

StevenC


1 Answers

There isn't a way to get JavaDoc to run on an empty package. There is a really old bug (JDK-4492654) posted for this marked as "Closed, Will Not Fix".

In that bug the workaround is pretty much the obvious hacky one you mention, create a default-scoped empty class. The class won't be included in the javadoc unless you force it to be with -package or -private.

/** hack to generate package javadoc */
class PlaceHolder {}
like image 157
Rich Seller Avatar answered Feb 06 '23 14:02

Rich Seller