>Generating JavaDoc with Maven 3 and Tycho

>One of my pet peeves are projects that don’t provide some form of SDK information. Whether this be documentation on extension points or javadoc. This little peeve was irritated again when I was trying to find some information on some Mylyn WikiText API. Unfortunately it is hit or miss using the content assistance and hover assistance. Also, there was nothing generated API wise within the Mylyn Developer’s help.

So to put my foot where my mouth is, I realized we don’t publish current JavaDoc with the XSL Tools or the PsychoPath Processor builds. Adding Javadoc generation with Maven/Tycho is fairly easy, but not as easy as a straight maven based build. There is an added twist. Due to a bug in Tycho it doesn’t pass the source directories to the the javadoc mojo when you execute it. Fortunately the following steps work well. We’ll use the PsychoPath Processor as our example.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>org.eclipse.wst.xml.xpath2.processor</artifactId>
<packaging>eclipse-plugin</packaging>
<version>1.1.100-SNAPSHOT</version>
<name>PsychoPath XPath 2.0 Processor</name>

<parent>
<groupId>org.eclipse.wst.xml.xpath2</groupId>
<artifactId>org.eclipse.wst.xml.xpath2-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../../development/athena/org.eclipse.wst.xml.xpath2.releng</relativePath>
</parent>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
</build>
</project>

The key here is the <sourceDirectory> definition. You need to specify where the maven-javadoc-plugin is to find the source. Once this is done, it is as simple as executing the build with:


mvn clean install javadoc:aggregate

This will generate the javadoc and place in the target/site/apidocs/ directory where your parent pom resides.

As an added bonus, for those of you using Hudson, you can have the javadocs browseable using the JavaDoc plugin from hudson.

Take a look at the PsychoPath Processor build for an example.

Advertisements
This entry was posted in build, documentation, eclipse, maven, tycho, xml, xsl. Bookmark the permalink.

2 Responses to >Generating JavaDoc with Maven 3 and Tycho

  1. David Green says:

    >Did you install the Mylyn WikiText SDK? It not only has great javadoc but also comes with a developer guide.

  2. David Carver says:

    >Yes, plus I have the source code itself in the workspace, which should bring up the documentation and any javadoc it has. It is hit or miss most of the time.What I was looking for was info like:http://help.eclipse.org/helios/index.jsp?nav=/2_1Unfortunately it isn't online, which is where I typically search (I rarely use the built in help plugins).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s