You can create your own site descriptor for your project when you want to override the navigation tree for the site. For example, aside from the generated reports you want to add additional content to your site. In order for it to be accessible in the generated site, you must configure your site descriptor. You create the site descriptor in a file called site.xml which should be located in your src/site directory.
If you are migrating from Maven 1.x you will be interested to know that the navigation.xml file has been replaced by the site descriptor in Maven 2. The format is nearly the same, so you can probably reuse most of your old file.
There is an XML Schema Reference for the site descriptor available.
The XML Schema for the site descriptor is published at http://maven.apache.org/xsd/decoration-1.0.0.xsd.
Have a look at the site descriptor for Maven Site Plugin for a real life example.
The title of each generated page will be a combination of the site title and the title of the current page. By default the Site Plugin will use the value of the <name> element from your pom.xml file as the site title. The complete title for this page is "Maven Site Plugin - Configuring the Site Descriptor".
If you want to use a different site title, but do not want to change the <name> element in your pom.xml, you can configure this in your site.xml, like this:
<project name="My Site Title"> ... </project>
With the out-of-the-box Velocity template, the position of the "Last Published" date is configurable. By default, the position is on the left but you can change it. To do this, you can add a <publishDate> element to your site.xml like the following:
<project> ... <publishDate position="right"/> ... </project>
The position attribute can have one of these values: left, right, navigation-top, navigation-bottom, bottom.
If you want hide the publish date, you can use this in your site.xml:
<project> ... <publishDate position="none"/> ... </project>
The format of the "Last Published" date is the ISO date format that is recommended by the W3C. Because the web has an international, cross-cultural audience it is recommended to not change the date format.
You can show the "Version" of your project on the site, by adding a <version> element to your site.xml like this:
<project> ... <version position="right"/> ... </project>
The position attribute can have the same values as the publishDate attribute, see above. If the position attribute is omitted, the default value is left.
If you want hide the version, you can use this in your site.xml:
<project> ... <version position="none"/> ... </project>
You can add your own "Powered by" logo to your site. To do this, you add a <poweredBy> element in your site.xml like this:
<project> ... <poweredBy> <logo name="Maven" href="http://maven.apache.org/" img="http://maven.apache.org/images/logos/maven-feather.png"/> </poweredBy> ... </project>
Site descriptors are inherited along the same lines as project descriptors are. When you deploy a project, its site descriptor is also deployed so that it can be inherited.
By default, only the basic settings are inherited. From the body, only the links are inherited, and these accumulate to contain all the parents' site descriptor links.
However, it is possible to inherit menus as well. To do so, use the inherit attribute in the site descriptor. This can be either top or bottom, indicating where the inherited menu will be placed. For example:
<project> ... <body> ... <menu name="My Inherited Menu" inherit="top"> ... </menu> ... </body> ... </project>
There are several preset menus that can be used in the site descriptor to include generated content from your project. These are:
To include a preset menu, use the ref attribute. For example:
<project> ... <body> ... <menu ref="modules" /> ... </body> ... </project>
Note: The old syntax using ${reports}, ${parent} and ${modules} has been deprecated and you are encouraged to use the new syntax instead. The support for the old syntax will be removed in a future version of the Site Plugin.
Skins can be created to customize the look and feel of a site in a consistent way. For more information on creating a skin, see Creating a Skin. To use a specific skin in your project, you use the skin element of the site descriptor. This is a regular artifact or dependency-like element. For example, to use the Maven Classic Skin, you would include:
<project> ... <skin> <groupId>org.apache.maven.skins</groupId> <artifactId>maven-classic-skin</artifactId> <version>1.0</version> </skin> ... </project>
Note: The <version> element is optional and, like plugins, if omitted the latest version available will be used. It is recommended that you always specify a version so that your site is reproducible over time.
This skin will copy the necessary resources including CSS and if necessary use the included alternate Velocity template to render the site.
If you don't specify a skin, the Site Plugin will use Maven Default Skin.
The site.xml can contain some expressions, like ${project.name}. Each expression will be evaluated when the site is rendered.
Expressions can be:
Note: Support for some expressions, like ${project.name} is present in version 2.0-beta-5 of this plugin. Full support is available since version 2.0-beta-6.