mavenjavadocmaven-javadoc-plugin

Oracle javadoc links not working with maven javadoc plugin for java 11


Generated javadocs using maven plugin with config

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.4.1</version>
    <configuration>
        <source>11</source>
        <show>private</show>
        <nohelp>false</nohelp>
        <destDir>javadocs</destDir>
        <attach>true</attach>
        <includeDependencySources>false</includeDependencySources>
        <additionalJOption>--no-module-directories</additionalJOption>
    </configuration>
</plugin>

However for the jdk 11 javadoc, it redirects to https://docs.oracle.com/en/java/javase/11/docs/api/java/lang/String.html?is-external=true

Ideally it should redirect to https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true


Solution

  • Fixed it with javaApiLinks

    <configuration>
        <javaApiLinks>
            <property>
                <name>api_11</name>
                <value>https://docs.oracle.com/en/java/javase/11/docs/api/java.base/</value>
            </property>
        </javaApiLinks>
    </configuration>