Configuring links
Parameter
You can add cross reference links to external projects using the <links/> parameter. For instance:
<project> ... <reporting> (or <build>) <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>3.11.2</version> <configuration> <links> <link>http://commons.apache.org/dbcp/apidocs/</link> <link>http://commons.apache.org/fileupload/apidocs/</link> </links> ... </configuration> </plugin> </plugins> </reporting> (or </build>) ... </project>
Important Note: according the Javadoc specifications, all given links should have a fetchable /package-list
file.
You can try to detect all Javadoc links for the project's dependencies. You need to use the <detectLinks/> parameter. Detected links are based on the default Maven conventions. For instance, if your project has a dependency on Apache Commons Lang such as:
<project> ... <dependencies> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <versions>2.4</version> </dependency> </dependencies> ... </project>
The added Javadoc link will be https://commons.apache.org/lang/apidocs.
A Javadoc API link, depending the JDK version used by your project, will be added. The version of the Javadoc API is detected from the value of the <source/> parameter in the org.apache.maven.plugins:maven-compiler-plugin
(defined in ${project.build.plugins} or in ${project.build.pluginManagement}), or computed via the Javadoc Tool executable. To skip this link, you need to configure <detectJavaApiLink/> to false
.
Note: if you are using an unsupported JDK like 7.0, you can add its Javadoc API url using the <javaApiLinks/> parameter, i.e.:
<configuration> <javaApiLinks> <property> <name>api_1.7</name> <value>http://download.java.net/jdk7/docs/api/</value> </property> </javaApiLinks> ... </configuration>
Refer to <links/> parameter for more information.
Configuring offlineLinks
Parameter
If your project has modules, you can add cross reference links to your modules when your goals are not aggregator goals. For instance, if your project has two modules i.e.:
<project> ... <modules> <module>module1</module> <module>module2</module> </modules> ... </project>
The offlineLinks for module1 will be /absolute/path/to/
module2/target/site/apidocs
and the offlineLinks for module2 will be /absolute/path/to/
module1/target/site/apidocs
.
Important Note: all offlinelinks are based on the ${project.url} if present.
You can disable the cross reference for offlineLinks
using the <detectOfflineLinks/> parameter.
Refer to <offlineLinks/> parameter for more information.