How to build skin for Maven 2 Site Plugin

  Tagged

Maven is open source java build manager from Apache software foundation. It has a lot of interesting features including Project Object Model (POM) and extensible process Plugin framework.

One of standard and commonly used plugins is maven-site-plugin. It provides way to generate project documentation based on POM in form of web site. Starting from version 2.0-beta-5 it’s possible to create your own design (skin) for generated web site.

This blog record must be interesting for developers who already familiar with maven 2 and use it for development. I will try to describe basic steps how to make your own custom skin.

So, where is to start? First of all your skin is maven project and it comes like maven plugin. So you need to specify project packaging as “maven-plugin”:

4.0.0 com.kobyleha.maven.skins embedchat-skin maven-plugin 1.0 Custom skin for embedchat application project http://embedchat.org

All your site resources (css, images) must be located in “/src /resources” folder. You can use subfolders. As example “/src /resources /css” for css and “/src /resources /images” for skin pictures.

Heart of your skin is velocity template (site.vm). This file must be located in “/src /resources /META-INF /maven/” folder. For beginning you can take standard template provided by maven and change it for your needs. Default template can be found in jar from maven repository /org /apache /maven /doxia /doxia-site-renderer /1.0-alpha-8/ doxia-site-renderer-1.0-alpha-8.jar. File in jar -/org /apache /maven /doxia /siterenderer /resources /default-site.vm.

Site.vm is velocity template that can use any resources from project model. Example get you can access list of developers, additional project modules or dependencies.

Some designer work and I think you can get good skin for your project site.

Next step is installing your skin in repository (‘mvn install’ command) and apply it on some other maven project for site generation.

To use custom skin, you need to add record about it in you site.xml:

com.kobyleha.maven.skins embedchat-skin 1.0

And generate project site using “mvn site” command.

As example I provide skin, which I developed for embedchat application. With two modules demo project that use this skin. Result screenshot:

Resources:

  • You can download skin plugin.
  • You can download demo project, which use this plugin.
  • You can see life site, which use this skin.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Very good, thanks

Very good explanation. Helped me a lot ! Peter, Netherlands

thx!

thx! very useful indeed Thies

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

 
 
 
 
 
 
  • hooligan
  • cupuyc
  • ESoImk
  • LeKz
  • Anton
 
 
 
© 2006-2008 kobyleha.com