In IntelliJ IDEA 2017.2, the Maven Projects
panel offers a menu for downloading source code and/or documentation for all the dependencies. Discussed in this other Question. Nice to have, but sometimes overkill. I want the doc for only one dependency.
➠ Is there a way to easily download source and/or documentation for individual libraries rather than all?
And is there a way to browse what dependencies currently have source and/or documentation downloaded?
Click on the "maven projects" (make sure tool buttons are on) on the right side of intelij and then click on "Download Documentation".
Via the Maven index, you can search for dependencies, select them and add them to your pom file. To download the index, select Windows > Preferences > Maven and enable the Download repository index updates on startup option. After changing this setting, restart Eclipse. This triggers the download of the Maven index.
Multiple transitive dependencies can be excluded by using the <exclusion> tag for each of the dependency you want to exclude and placing all these exclusion tags inside the <exclusions> tag in pom. xml. You will need to mention the group id and artifact id of the dependency you wish to exclude in the exclusion tag.
1) Downloading individual documentation and sources:
From the maven tool window, expand the dependencies, and select the desired one, then right click it and chose your option. Although the menu item description which IJ displays in the lower left corner of the IDE reads Downloads xxx for AL DEPENDENCIES for selected projects
, it seems to download the details just for the selected libraries. Maybe it's just a reused description or menu?!
P.S. If I'm not mistaking, at one time, it was also possible to download missing docs from the docs popup window (default on win CTRL + Q), but I can no longer see it... I'll come back to this if I manage to find it.
2) Figuring out what libraries have downloaded docs a/o sources:
Go to File
-> Project structure
(default on Win is CTRL + ALT + SHIFT + S) -> Libraries
. Alternatively from the project tool window select a dependency and press F4 (or Right click -> Open library settings).
As you and browse through the list, you'll see that those that already have the documentation a/o sources have a regular coloured font...
... while those that don't, are coloured in red:
3) Download decompiled class sources:
<classifier>
tag in POMYou can also do this in the POM, using the <classifier>
element. See Maven reference page.
Copy your dependency and add <classifier>javadoc</classifier>
to it.
Similarly, one can add <classifier>sources</classifier>
to download the source code. Note the plural form of sources
, not source
.
Example:
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>11.8</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-core</artifactId>
<version>11.8</version>
<classifier>sources</classifier> <!-- ⟸ Use `sources` to download source-code for this dependency. -->
</dependency>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With