Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javadoc auto generation for intellij

Is there an automatic Javadoc generation plugin for IntelliJ? Example http://jautodoc.sourceforge.net/

like image 962
joshjdevl Avatar asked Jan 13 '11 14:01

joshjdevl


People also ask

How do I create an automatic Javadoc?

In the Package Explorer view, select a Java project and click Project > Generate Javadoc with Diagrams > Automatically. In the Generate Javadoc wizard, under Javadoc command, select the Javadoc command (an executable file).

How do I create a Javadoc for a whole project?

To generate JavaDoc in Eclipse: –Select “Generate JavaDoc” option from Project menu and a wizard will appear. Specify the location for the JavaDoc file on your computer, by default it will be in the C drive. Select the project and then the packages for which you want to create the JavaDoc file.

How do I create a method level comment in IntelliJ?

Create JSDoc commentsPosition the caret before the declaration of the method/function or field to document, type the opening block comment /** , and press Enter . IntelliJ IDEA generates a JSDoc comment with a list of parameters ( @param ) and return values ( @returns ), where applicable.


2 Answers

Javadoc generation (writing the .html files) is done for you on-demand (Tools->Generate Javadoc) and is essentially automatic once you set it up. Generating javadoc stubs, which is what jautodoc for Eclipse does, is done method-by-method, class-by-class and only where you tell it to.

Typing /** <enter> above a method signature will create Javadoc stubs for you. I suspect you want something that will do this for an entire file, package or project though (like jautodoc). There used to be such a plugin: http://plugins.intellij.net/plugin/?id=952 but it won't work with 10.

I do have to say that this jautodoc example, while a neat party trick, is the single most useless thing I've ever seen in an IDE: It creates a description based on the variable name - but only if the variable name is so descriptive that it doesn't need a comment in the first place.

/**
 * The number of questions
 */
private int numberOfQuestions;

Makes you yearn for punched card.

like image 76
Tim Avatar answered Oct 31 '22 02:10

Tim


Updated the answer for 2020.3 version of IntelliJ (also works in 2019.2)

  1. Download plugin "JavaDoc" (Ctrl + Shift + A > Plugins > Marketplace tab > search for JavaDoc (by vendor: "Sergey Timofiychuk") > Install)

and follow below steps (from Step 2).

--PREVIOUS ANSWER--

Tested below in 2018.2 version of IntelliJ

  1. Download plugin "JavaDoc2" (Ctrl + Shift + A > Plugins > Browse Repositories... > JavaDoc2)
  2. Restart IntelliJ (File > Invalid Caches/Restart... > Just Restart)
  3. For current element: To generate Javadoc for current element (say a setter method), press Alt + Shift + G. If this doesn't work due to different keymap association, try Alt + Insert and selecting Create JavaDocs for the selected element
  4. Whole class: To generate for the whole class, press Ctrl + Alt + Shift + G (or Alt + Insert and selecting Create JavaDocs for all elements)

(One caveat is, it is generating javadoc only for public methods, not for fields and private methods)

like image 36
KrishPrabakar Avatar answered Oct 31 '22 03:10

KrishPrabakar