How do I integrate static (x)html pages into my Maven site?

You can integrate your static pages by following these steps:

  • Put your static pages in the resources directory, ${basedir}/src/site/resources
  • Create your site.xml and put it in ${basedir}/src/site
  • Link to the static pages by modifying the menu section, create items and map them to the filenames of the static pages
Why do my absolute links get translated into relative links?

This happens because the site plugin tries to make all URLs relative, when possible. If you have something like this defined in your pom.xml: http://www.your.site.com/ and create links in your site.xml (just an example) like this: You will see that the link to 'Your site' will be a relative one, but that the link to 'Maven 2' will be an absolute link.

There is an issue for this in JIRA, where you can read more about this.

Why doesn't the links between parent and child modules work when I run 'mvn site'?

What 'mvn site' will do for you, in a multi-project build, is to run 'mvn site' for the parent and all its modules individually. The links between parent and child will not work here. They will however work when you deploy the site.

If you want to test this, prior to deplyment, you can run 'mvn site:stage' instead. This will produce the complete site, including the parent and its modules, in the /target/staging/ directory of the parent. The site can be found a couple of directory levels down from the there, because the hostname and path, as specified in the <distributionManagement>/<site>/<url> element of your pom.xml, will each get their own directory.