This post originated from an RSS feed registered with Java Buzz
by Nick Lothian.
Original Post: Some tips for customising Maven built websites
Feed Title: BadMagicNumber
Feed URL: http://feeds.feedburner.com/Badmagicnumber
Feed Description: Java, Development and Me
Struggling to work out how to customise your Maven built website? Here's
a few thing I've figured out. All this is actually documented on the Maven site, but I found it a little
hard to find.
The first thing I wanted to do was include some custom pages on my site. To do this, you need to create an
"xdocs" directory in the root of your project, and put the files you want to end up on your site in there. Anything
except .xml files will be copied to the target/docs directory, which allows you to use images or plain HTML files. If
you want your pages to be generated in the same style as the rest of the Maven generated pages, you need to use a format
called xdocs. The xdocs format is (somewhat) documented on
the Jakarta site (ie, there is an example file). In my experience so far, it is basically a cut down, xmlised version
of html.
Now you can run maven site:generate and your new page will be generated. However, it will not show up on
the menu yet. To do that you will need to create a file called navigation.xml in your xdocs directory. The format
for this file is documented on the Maven site. I needed to leave out the
encoding from the example for it to work for me, however.
navigation.xml also controls what Maven calls the "navigation bar". This is the bar across the top of the page,
that typically has a link to the Maven site at the top right side. To modify that, create a "links" section inside the body
of navigation.xml.