How to build skin for Maven 2 Site Plugin
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”:
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:
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:
»
- 3175 reads
- Russian
Very good, thanks
thx!
Post new comment