Thursday, March 08, 2007

Maven2: creating JavaDoc links behind a firewall

I just spent the better part of the morning trying to make javadoc links work. In short: configuring the proxy did not work - We have to cope with offline package-lists, not a big problem really. Of course, to configure the maven-javadoc-plugin to do this, reading the source was the quickest way to go. So put something like this in your pom.xml:

<reporting>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<linksource>true</linksource>
<offlineLinks>
<offlineLink>
<url>http://java.sun.com/j2se/1.5.0/docs/api/</url>
<location>T:/maven/apidoc-packagelists/jdk-1.5.0</location>
</offlineLink>
</offlineLinks>
<docfilessubdirs>true</docfilessubdirs>
<excludedocfilessubdir>CVS</excludedocfilessubdir>
</configuration>
</plugin>

The locations must be valid Java file paths, pointing to a locally accessible directory which contains the package-list file for the given url.