assertj: Generating Javadoc in a Maven project using does not work
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.
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 29 (4 by maintainers)
Agree.
@michael-o A long time ago I’ve created an issue in the Maven Javadoc plugin project: https://issues.apache.org/jira/projects/MJAVADOC/issues/MJAVADOC-792
Maybe we should continue the discussion there.
Prepare a test branch for you guys…
You have to use
<dependencyLinks>if<detectLinks>is enabled.The
<links>option just adds additional links.@scordio You are right. Many other projects do not follow the convention, but none of them has broken my build so far.
In other projects, the Maven plugin detects the ‘invalid’ links and doesn’t forward them to the javadoc tool. Maybe the Maven plugin should interpret the
#character the same way the javadoc plugin does.Currently, my workaround seems to be the way to go.