Friday, February 09, 2007

Velocity based static website generation under Maven2

For several times I went into the situation where I need to seriously decorate a Maven2 generated website, and a more powerful and scriptable way of writing page content than APT and XDOC is required. CSS can do some decoration work and a customized master velocity layout for maven-site-plugin gives me full control of the template. But still, APT and XDOC are limited as a script language to write content. Velocity content may be ideal.

The idea is rendering Velocity template in a way similar to VelocityLayoutServlet and Apache Turbine, which is merging context with velocity template for content body, then put the body into another layout Velocity template. This work can be done within a maven2 goal easily.

In existing arapaho-maven-plugin project, I created flatsite mojo to do this Velocity based static website generation. It's basically a one class deal so I didn't make it a standalone maven2 plugin. It's not a maven2 report, it's a simplified version of maven-site-plugin replacement.

After flatsite mojo is created, I migrated two existing website subprojects to website project and made them generated by arapaho-maven-plugin:flatsite. These two subprojects are example sites of flatsite.

No comments: