Configuring Reports

Maven has several reports that you can add to your web site to display the current state of the project. These reports take the form of plugin goals, just like those used to build the project.

Maven Project Info Reports Plugin provides many standard reports by extracting information from the POM, for example:

  • Continous Integration
  • Dependencies
  • Issue Tracking
  • License
  • Mailing Lists
  • Project Team
  • Source Repository

To find out more please see to the Project Info Reports Plugin.

To add these reports to your site, you must add the plugin to the <reporting> element in the POM. The following example shows how to configure the standard Project Info Reports that display information from the POM in a friendly format:

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.6</version>
      </plugin>
    </plugins>
  </reporting>
  ...
</project>

If you have included the appropriate <menu ref="reports"/> tag in your site descriptor, then when you regenerate the site those items will appear in a menu called "Project Reports".

Note: Many report plugins provide a parameter called outputDirectory or similar to specify the destination for their report outputs. This parameter is only relevant if the report plugin is run standalone, i.e. by invocation directly from the command line. In contrast, when reports are generated as part of the site, the configuration of the Maven Site Plugin will determine the effective output directory to ensure that all reports end up in a common location.

Check out reporting plugins ("R" value in the "Type" column) in the plugins page, for a list of available reporting plugins from Apache Maven Team.

Selecting Reports from a Plugin: Configuring Report Sets

By default, when you add a plugin in reporting section, every reporting goal available in the plugin is rendered once.

If you want to choose only some reports from a plugin, or if you want to run a report multiple times with a different configuration, you need to configure report sets:

<project>
  ...
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.6</version>
        <reportSets>
          <reportSet>
            <reports><!-- select reports -->
              <report>index</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9</version>
        <reportSets>
          <reportSet><!-- by default, id = "default" -->
            <reports><!-- select non-aggregate reports -->
              <report>javadoc</report>
              <report>test-javadoc</report>
            </reports>
          </reportSet>
          <reportSet><!-- aggregate reportSet, to define in poms having modules -->
            <id>aggregate</id>
            <inherited>false</inherited><!-- don't run aggregate in child modules -->
            <reports>
              <report>aggregate</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>
  ...
</project>

Notice: don't forget to define reportSets for plugins which provide aggregator reports, like maven-javadoc-plugin, maven-jxr-plugin or maven-checkstyle-plugin or you'll have these aggregate reports run by default in addition to non-aggregate reports.

See the reportSet documentation in POM reference for complete description of available configurations.