What is the difference between mvn site and mvn site:site?
mvn site
Calls the site phase of the site lifecycle. Full site lifecycle consists in the following life cycle phases: pre-site, site, post-site and site-deploy. See Lifecycle Reference. Then it calls plugin goals associated to pre-site and site phases.
mvn site:site
Calls the site goal of the site plugin. See site:site.


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


How to include a custom Doxia module, like Twiki?

The site plugin handles out-of-box apt, xdoc and fml formats. If you want to use a custom format like Twiki, Simple DocBook, or XHTML (or any other document format for which a doxia parser exists, see the list of Doxia Markup Languages), you need to specify the corresponding Doxia module dependency, e.g. for Twiki:

            <version><!-- doxia version appropriate to the site plugin version --></version>

Note that the doxia version has to be adjusted to the site-plugin version you are using, see the Migration Guide. In particular, for site plugin versions >=2.1 you need to use doxia >=1.1.


How can I validate my xdoc/fml source files?

Since version 2.1.1 of the Site Plugin, there is a validate configuration parameter that switches on xml validation (default is off). Note that in the current implementation of the parser used by Doxia, validation requires an independent parsing run, so that every source file is actually parsed twice when validation is switched on.

If validation is switched on, all xml source files need a correct schema and/or DTD definition. See the Doxia documentation on validating xdocs, and the schema definitions for xdoc and fml.


How does the Site Plugin use the <url> element in the POM?

The Site Plugin does not use the <url> element in the POM. The project URL is just a piece of information to let your users know where the project lives. Some other plugins (e.g. the project-info-report-plugin) may be used to present this information. If your project has a URL where the generated site is deployed, then put that URL into the <url> element. If the project's site is not deployed anywhere, then remove the <url> element from the POM.

On the other hand, the <distributionManagement.url> is used in a multi-module build to construct relative links between the generated sub-module sites. In a multi module build it is important for the parent and child modules to have different URLs. If they have the same URL, then links within the combined site will not work. Note that a proper URL should also be terminated by a slash ("/").


Specific issues

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:

and create links in your site.xml (just an example) like this:
  <item name="Your Site" href=""/>
  <item name="Maven 2" href=""/>
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 don'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 deployment, you can run the site:stage goal as described in the usage documentation instead.


Can I use entities in xdoc/fml source files?

Yes. Entity resolution has been added in Doxia version 1.1, available in Site Plugin 2.1 and later.

There is a catch however. In the current implementation (as of maven-site-plugin-2.1.1), entities are only resolved by an independent validation run. Therefore, if you want to use entities, you have to switch on validation for your xml source files. See MSITE-483.