JavaDoc with Maven generates 'Error fetching link:'
Asked Answered
T

1

9

Generating a JavaDoc with Maven I get an error message 'Error fetching link:' referring to a file javadoc-bundle-options. In it it contains javadocResourcesDirectory with a directory. Even if I create that directory I still get the same error. How can I correct the error?

    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <version>3.2.0</version>
    <configuration>
        <show>public</show>
        <quiet>true</quiet>
        <doctitle>${project.name}</doctitle>
        <sourceFileExcludes>**/tests/**/*.java</sourceFileExcludes>
        <links>
            <link>https://docs.oracle.com/en/java/javase/14/docs/api/</link>
        </links>
        <javadocDirectory>javadoc/resources</javadocDirectory>
   </configuration>
    <executions>
        <execution>
            <id>javadocs-jar</id>
            <phase>package</phase>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

    <?xml version="1.0" encoding="UTF-8"?>
<javadocOptions>
  <docletArtifacts>
    <docletArtifact />
  </docletArtifacts>
  <tagletArtifacts>
    <tagletArtifact />
  </tagletArtifacts>
  <links>
    <link>https://docs.oracle.com/en/java/javase/14/docs/api/</link>
  </links>
  <javadocResourcesDirectory>javadoc/resources</javadocResourcesDirectory>
</javadocOptions>
Thebault answered 18/4, 2020 at 15:56 Comment(0)
V
4

According to the Apache Maven Issue: https://issues.apache.org/jira/browse/MJAVADOC-623 this is a bug in the Maven JavaDoc Plugin version 3.1.1.

You can "correct" the error by trying to use version 3.1.0, or use the fixed version of the plugin when it is released (at time of writing this, it still hasn't been released).

EDIT (1):

A workaround is to add the maven.compiler.release property to the Maven project file:

<project>
  <properties>
    <maven.compiler.release>11</maven.compiler.release>
  </properties>
</project>

EDIT (2):

A workaround is to specify the Java release in the Maven JavaDoc Plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>3.2.0</version>
  <executions>
    <execution>
      <id>main-javadoc</id>
      <phase>package</phase>
      <goals>
        <goal>jar</goal>
      </goals>
      <configuration>
        <release>11</release>
      </configuration>
    </execution>
  </executions>
</plugin>
Viscoid answered 25/9, 2020 at 3:0 Comment(1)
Maven JavaDoc plugin 3.2.0 is also affected by this bug.Viscoid

© 2022 - 2024 — McMap. All rights reserved.