After upgrading from Java 9 to 10, links to the JDK no longer work when generating documentation with the Javadoc tool (e.g., for a file importing java.util.Optional
My workaround for the moment is to point javadoc.exe at a local package-list using the offlineLinks option of the Maven Javadoc plugin (which corresponds to the linkoffline option of the Javadoc tool). I added the following to the configuration section for the plugin:
false
https://docs.oracle.com/javase/${maven.compiler.release}/docs/api/
${project.basedir}
And I added to the properties section of my pom.xml so that I could use ${maven.compiler.release} in the value for the url. (That makes the source and target compiler options redundant, but IntelliJ doesn't seem to understand release when importing Maven projects, so I kept them.)
I created a text file named package-list (no file extension) and put it in the root directory of the project (hence ${project.basedir} for the location, which is where it will look for package-list). That file looks like this:
java.lang
java.util
java.util.concurrent
java.util.function
java.util.stream
It only needs the packages that you're trying to link to. I also tried naming the file element-list and following the format that javadoc.exe uses for modularized projects, like so:
module:java.base
java.lang
java.util
java.util.concurrent
java.util.function
java.util.stream
But that didn't work (Javadoc successfully generated, but no JDK links, as before). It complained that it couldn't find package-list.
So, once again, the relevant bits of the pom.xml:
10
10
10
UTF-8
org.apache.maven.plugins
maven-compiler-plugin
3.7.0
org.ow2.asm
asm
6.1
org.apache.maven.plugins
maven-javadoc-plugin
3.0.0
false
https://docs.oracle.com/javase/${maven.compiler.release}/docs/api/
${project.basedir}
attach-javadocs
jar