I have seen this question asked several times but no solution works for me. So perhaps with the simple repeatable steps listed below and your help we can get to the bottom of it.
Set-up
IntelliJ idea version: 2020.2.1, Gradle version: 4.10.3
create a
test-project
directory somewhereinside that directory run the following to create a template project:
$ gradle init --type java-application
now open that project with Idea
First Impressions
This template project comes with Guava library specified as a dependency so you can write code like shown below and it will work and Javadoc will be displayed:
Removing the Dependency
If you comment out the dependency in build.gradle
and reload the project using the Gradle tool window, you will see this:
Adding Local JAR's
Now let's pretend we were sent the Guava library and Javadoc JAR's in an email like in the good ol' days, and we want to use them in the project.
I plonked the jars into lib/google/guava/23.0
in the project and adjusted my build.gradle
sample to look like this:
plugins {
id 'java'
id 'application'
id 'idea' // <-- added this
}
mainClassName = 'App'
idea {
module {
downloadJavadoc = true // <-- and this
} // but makes no difference
}
dependencies {
// compile 'com.google.guava:guava:23.0'
compile 'google:guava:23.0' // <-- also this
testCompile 'junit:junit:4.12'
}
repositories {
jcenter()
maven {
url file('lib') // and finally this
}
}
and this kind of works, after another reload, in the sense that the library is available again:
What isn't available is Javadoc. How to make it work?
Fiddling with Module Settings
One suggestion I found in other answers is to go to Module Settings and add the directory with the jars to the Dependencies section.
That also kind of works for the library but again not for Javadoc. One difference is that when I go this route the Javadoc library seems to get noticed for the first time by Idea, as a little arrow appears in the Project pane next to the file and you can browse the content and have the Javadoc pages opened in a web browser but that's about it.
When you reload the Gradle project that setting gets wiped, so not really a solution even if it fully worked.