Sunday, October 10, 2010

Maven site and multi-module broken links on site:stage

Maven 2.2.1 default site plugin does a strange job of making parent to child links for a multimodule site report. When I have the parent reporting url set to a file:// url the links are broken after doing a site:stage. There is an easy workaround though. Make the reporting url a property in the parent pom.xml, say ${site.url} and from parent directory call

mvn clean site site:deploy -Dsite.url=file://`pwd`/target/deployed-site

This will deploy the site into target/deployed-site. Note that the url must be absolute, that's why I use `pwd` to insert the current directory (not for windoze of course). Put whatever url you like in site.url if the above does not suit.