Download doc for only one Maven dependency in IntelliJ

Viewed 788

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.

enter image description here

➠ 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?

2 Answers

<classifier> tag in POM

You can also do this in the POM, using the <classifier> element. See Maven reference page.

For Javadoc

Copy your dependency and add <classifier>javadoc</classifier> to it.

For source-code

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>
Related