Maven Sites and Sourceforge
Tuesday, May 4, 2010 at 8:43PM The Maven site for the User Type project is now online. This site makes use of the excellent Fluido Skin which gives a cleaner, crisper look in comparison to the standard skin.
There's a huge amount of metrics and reporting plugged into the site generation, but some of the features are of particular interest.
Class diagram visualisations can be found throughout the Javadocs. These are generated using the UML Graph doclet, using the following example configuration (suitable for Java 5):
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.6.1</version> <configuration> <linksource>true</linksource> <links> <link>http://java.sun.com/j2se/1.5.0/docs/api/</link> </links> <encoding>UTF-8</encoding> <executions> <execution> <id>attach-javadocs</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> <aggregate>true</aggregate> <doclet>gr.spinellis.umlgraph.doclet.UmlGraphDoc</doclet> <docletArtifact> <groupId>gr.spinellis</groupId> <artifactId>UmlGraph</artifactId> <version>4.6</version> </docletArtifact> <additionalparam>-attributes -enumconstants -enumerations -operations -types -visibility -inferrel -inferdep -hide (java.*)|(org.hibernate.*)|(org.joda.*)</additionalparam> </configuration> </plugin>
The enforcer plugin is being used to require Java 5, and Maven 2.2.1 - to help guarantee that builds are reproducible. Together with these requirements, the use of commons-logging is prohibited. This is a great practice which helps ensure all logging is performed using SLF4J:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-enforcer-plugin</artifactId> <version>1.0-beta-1</version> <executions> <execution> <id>enforce-versions</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireMavenVersion> <version>2.2.1</version> </requireMavenVersion> <requireJavaVersion> <version>1.5.0</version> </requireJavaVersion> <bannedDependencies> <excludes> <exclude>commons-logging:*</exclude> </excludes> </bannedDependencies> <requirePluginVersions> <banLatest>true</banLatest> <banRelease>true</banRelease> <banSnapshots>true</banSnapshots> <unCheckedPluginList></unCheckedPluginList> </requirePluginVersions> </rules> </configuration> </execution> </executions> </plugin>
You will also note that enforcer requires that exact versions are required for all utilised plugins. Again, this guarantees the reproducibility of builds.
Another point of interest is the use of toolchains. Toolchains allows you to externalise the JDK under which Maven runs from the JDK used for building. This would be particularly relevant for a project using recent builds of Maven which require Java 5, but needing to build using an older JDK.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-toolchains-plugin</artifactId> <version>1.0</version> <executions> <execution> <phase>validate</phase> <goals> <goal>toolchain</goal> </goals> </execution> </executions> <configuration> <toolchains> <jdk> <version>5.0</version> <vendor>sun</vendor> </jdk> </toolchains> </configuration> </plugin>
Setting up a Maven site is surprisingly straightforward. A good howto guide is available on CommunityMapBuilder, and the Maven documentation describes the steps that need to performed to enable a shell which can be used with mvn site-deploy. You must display the Sourceforge logo on your Maven site, which can be achieved by including a 'poweredBy' entry in the site.xml file:
<poweredBy>
<logo name="Hosted by SourceForge" href="http://www.sourceforge.net/" img="http://sourceforge.net/sflogo.php?group_id=16035&type=1" />
...
</poweredBy>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.6.1</version>
<configuration>
<linksource>true</linksource>
<links>
<link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
</links>
<encoding>UTF-8</encoding>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<aggregate>true</aggregate>
<doclet>gr.spinellis.umlgraph.doclet.UmlGraphDoc</doclet>
<docletArtifact>
<groupId>gr.spinellis</groupId>
<artifactId>UmlGraph</artifactId>
<version>4.6</version>
</docletArtifact>
<additionalparam>-attributes -enumconstants -enumerations -operations -types -visibility -inferrel -inferdep -hide (java.*)|(org.hibernate.*)|(org.joda.*)</additionalparam>
</configuration>
</plugin>
Chris |
Post a Comment |
Maven,
UML,
User Type Project 
Reader Comments