How to configure Maven2 to use yWorks UML Doclet
Questions & AnswersSummary
Description
Since the Javadoc plugin for Maven2 does support custom doclets, yWorks UML Doclet does work with Maven 2. To configure Maven to use yWorks UML Doclet, you need to adjust your pom.xml file accordingly:...
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<doclet>ydoc.doclets.YStandard</doclet>
<docletPath>[yworks_uml_doclet_dir]/lib/ydoc.jar:[yworks_uml_doclet_dir]/lib/class2svg.jar:[yworks_uml_doclet_dir]/resources</docletPath>
<additionalparam>-umlautogen</additionalparam>
</configuration>
</plugin>
...
</plugins>
</build>
...
Note: If working on Windows, you should use '\' instead of '/' and ';' instead of ':' in any path arguments.
Note: Since yWorks UML Doclet 3.0, the class2svg.jar library no longer exists and therefore should not be referenced in docletpath anymore.
Any yWorks UML Doclet specific options go into the <additionalparam> argument. For instance, you want to use yWorks UML Doclet's ExcludeFilter and UML generation, the <additionalparam> argument would then be:
... <additionalparam>-filter ydoc.filters.ExcludeFilter -filterpath [yworks_uml_doclet_dir]/lib/ydoc.jar -umlautogen</additionalparam> ...
Maven2 will (unfortunately) ignore the following configuration parameters when using a custom doclet:
author bottom breakiterator charset docfilessubdirs docencoding doctitle excludedocfilessubdir footer groups header helpfile links linksource offlineLinks nodeprecated nodeprecatedlist nocomment nohelp noindex nonavbar noqualifier nosince notree serialwarn splitindex stylesheet taglet tagletpath tags use version windowtitle
So, if you normally use one of the above parameters, you have to include the standard javadoc option (i.e. the option as it is used when invoking javadoc directly from command line, see http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javadoc.html#options for additional information) in the <additionalparam> argument.
For example, if you want to link to existing javadoc-generated documentation of external referenced classes. To link to the Sun JDK 1.5 API, you usually set up Maven's Javadoc plugin with something along the lines of
... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <links> <link>http://java.sun.com/j2se/1.5.0/docs/api/</link> </links> </configuration> </plugin> ...
Since <links> is ignored by Maven when you are using a custom doclet, you have to write it this way:
... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> <doclet>ydoc.doclets.YStandard</doclet> <docletPath>[yworks_uml_doclet_dir]/lib/ydoc.jar:[yworks_uml_doclet_dir]/lib/class2svg.jar:[yworks_uml_doclet_dir]/resources</docletPath> <additionalparam>-link http://java.sun.com/j2se/1.5.0/docs/api/ -umlautogen</additionalparam> </configuration> </plugin> ...
Note: Since yWorks UML Doclet 3.0, the class2svg.jar library no longer exists and therefore should not be referenced in docletpath anymore.