Two ways to integrate Javadoc into IntelliJ IDEA

Do you Google for Javadoc? Isn’t it annoying? Picture this: you’re in a flow state, with a full stack on your mind, and a good couple dozen business concepts thrown in, and you just want to double-check the behavior of a given library method. Do you re…


This content originally appeared on DEV Community and was authored by scottshipp

Do you Google for Javadoc? Isn't it annoying? Picture this: you're in a flow state, with a full stack on your mind, and a good couple dozen business concepts thrown in, and you just want to double-check the behavior of a given library method. Do you really want to stop what you're doing, open a browser, search for the library documentation, make sure you are looking at the right version, and then navigate to the class and method in question?

You don't have to!

Here are two fast and easy ways to add Javadoc to IntelliJ so you can see it using the "Quick Documentation" feature: simply hover your mouse on any piece of code or use the Quick Documentation shortcut key, Ctrl+Q for Linux or Windows and F1 on macOS!

Now, on to the first way.

Using Maven

On Maven projects, run the dependency:resolve phase with classifier=javadoc and IntelliJ will automatically acquire documentation superpowers.

There are two ways to run this. First, you can run the following Maven command from the terminal inside the root directory for the project:

$ mvn dependency:resolve -Dclassifier=javadoc

You can also run that from the "Execute Maven goal" window, which appears when you open the Maven tool window (View > Tool windows > Maven) and press the "M" icon.

The Execute Maven Goal window in IntelliJ

If you want, you can even tell Maven to always download Javadoc when available. Navigate to Preferences > Build, Execution, Deployment > Build Tools > Maven > Importing and check the Automatically download documentation checkbox.

With a URL or Jar file

Do you have a URL to some Javadoc on the web? Then open Project Structure, navigate to Libraries, and click the icon that combines a "+" and a globe.

The Libraries UI in IntelliJ

Paste the URL and save it.

If you happen to have the javadoc in a jar file instead, you can use the normal "+" icon you see in this same Project Structure > Libraries window.

What it looks like

With any of those settings in place, you can simply hover your mouse on any piece of code and see the resulting Javadoc.

Quick Documentation view in IntelliJ

Conclusion

With Javadoc just a mouse-hover away, you can remain focused on the task at hand rather than disrupting your flow and going on a wild goose chase.

Photo by Miriam Espacio from Pexels


This content originally appeared on DEV Community and was authored by scottshipp


Print Share Comment Cite Upload Translate Updates
APA

scottshipp | Sciencx (2021-10-05T15:55:33+00:00) Two ways to integrate Javadoc into IntelliJ IDEA. Retrieved from https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/

MLA
" » Two ways to integrate Javadoc into IntelliJ IDEA." scottshipp | Sciencx - Tuesday October 5, 2021, https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/
HARVARD
scottshipp | Sciencx Tuesday October 5, 2021 » Two ways to integrate Javadoc into IntelliJ IDEA., viewed ,<https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/>
VANCOUVER
scottshipp | Sciencx - » Two ways to integrate Javadoc into IntelliJ IDEA. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/
CHICAGO
" » Two ways to integrate Javadoc into IntelliJ IDEA." scottshipp | Sciencx - Accessed . https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/
IEEE
" » Two ways to integrate Javadoc into IntelliJ IDEA." scottshipp | Sciencx [Online]. Available: https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/. [Accessed: ]
rf:citation
» Two ways to integrate Javadoc into IntelliJ IDEA | scottshipp | Sciencx | https://www.scien.cx/2021/10/05/two-ways-to-integrate-javadoc-into-intellij-idea/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.