News and Notes from the Makers of Nexus | Sonatype Blog

Browsing Javadoc for Dependencies in Eclipse: m2eclipse

Written by Tim OBrien | October 23, 2008

I created this video as a response to Martjin Dashorst's post on why Javadoc isn't distributed with Wicket. Given the ease with which you can browse Javadoc in m2eclipse, I think the days of cutting a "distribution" with aggregated Javadoc are behind us. While it is entirely possible to create aggregated Javadoc with Maven, I wanted to use this as an opportunity to show people how simple it is to browse Javadoc and Source in m2eclipse.

[vimeo]http://www.vimeo.com/2057354[/vimeo]

The Javadoc is Already in the Maven Repository

If people are looking for JavaDoc, point them at the Maven Repository - they can use m2eclipse to easily browse the Javadoc. You've already published the Javadoc and the Source code for Wicket 1.3.5 alongside the Wicket JARs. If you want to point people toward the easiest way to read JavaDoc, point people at this 5 minute video screencast. This screencast demonstrates:

  1. Creating a Wicket project using the Maven Archetype
  2. Configuring Eclipse to download the Source and JavaDoc archives
  3. Browsing Wicket JavaDoc using Eclipse
  4. Browsing Wicket Source using Eclipse
  5. Starting Jetty using m2eclipse

m2eclipse makes most of this trivial, and it should reduce the pressure on you to have to jump through all the hoops necessary to create aggregate Javadoc in the Wicket distribution. "You want Javadoc? We've published all the Javadoc in the Maven repository."

...but if you really need to generate aggregate Javadoc...

The more direct answer to Martjin's core problem - generating Javadoc to include in the Wicket distribution: I understand his frustration with the Maven Site plugin, I share it and have gone to great lengths to avoid using it. But, it should be easy to generate aggregate JavaDoc for Wicket. My advice would be to forget the Maven Site plugin and:

  • Bind javadoc:aggregate to a phase in the top-level project.
  • Include the resulting ${basedir}/target/site/apidocs in your Wicket distribution assembly

I ran javadoc:aggregate for a while to generate aggregate Wicket Javadoc on Minotaur, but I've stopped doing this in favor of just configuring m2eclipse to automatically download sources in m2eclipse. I understand that such an answer isn't going to satisfy people that don't use Eclipse as an IDE, but nothing stops others from developing tools that make use of the Javadoc and Source code available in the Maven repository. Anyway, hope this helps.