Skip to content

Generating Javadoc in a Maven project using <detectLinks> does not work #3476

@alerosmile

Description

@alerosmile

The maven-javadoc-plugin has an option detectLinks which enables detection of Javadoc links of dependent projects. The detection works only if the dependent project follows the default Maven conventions (javadoc must be located under ${project.url}/apidocs).

The project URL of assertj-core is https://assertj.github.io/doc/#assertj-core. The Maven plugin first checks if the URL https://assertj.github.io/doc/#assertj-core/apidocs/element-list is accessible and then forwards the URL 'https://assertj.github.io/doc/#assertj-core/apidocs' to the javadoc tool.

But the javadoc tool interprets the # character, reads the URL https://assertj.github.io/doc/package-list and obviously fails:

Error fetching URL: https://assertj.github.io/doc/#assertj-core/apidocs/ (java.io.FileNotFoundException: https://assertj.github.io/doc/package-list)

I can workaround this by defining in my project:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-javadoc-plugin</artifactId>
    <configuration>
      <dependencyLinks>
        <dependencyLink>
          <groupId>org.assertj</groupId>
          <artifactId>assertj-core</artifactId>
          <url>https://www.javadoc.io/doc/org.assertj/assertj-core/${assertj.version}</url>
        </dependencyLink>
      </dependencyLinks>
    </configuration>
  </plugin>

Maybe the project URL of assertj-core should be https://www.javadoc.io/doc/org.assertj/assertj-core/${assertj.version} instead of https://assertj.github.io/doc/#assertj-core. But then the javadoc must be located under https://www.javadoc.io/doc/org.assertj/assertj-core/${assertj.version}/apidocs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions