Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

AbstractMavenReport

You need to implement your Mojo as AbstractMavenReport, then you can simply add it to the <plugin> section within the <reporting><plugins> section of your POM and your report will be generated and linked into the Maven site automagically:

and so on. @phase site binds your plugin to the site lifecycle of the build.
You need to implement or override the following methods:

  • public void executeReport(Locale defaultLocale) throws MavenReportException - This method is called during site phase to actually produce your report.
  • Other methods:
    For the use of getBundle() you need to provide a resource bundle in src/main/resources/my-report.properties that contains the necessary keys for your plugin, e.g.
    Note:: If you want to create the report without using Doxia, e.g. via XSL transformation from some XML file, then simply add the following method to your Mojo:

Doxia Sink

You also need to use the Doxia Sink API to have complete decoration (ie. menus). That is quite straightforward. You simply import org.apache.maven.doxia.sink.Sinkand get an instance by simply calling the class method getSink() (you don't even have to implement it). Then you can do things like that:

to get <td>some text</td>.

More than report from one plugin

If you want to have more than one goal in our plugin to generate several reports, simply add another Mojo with its own @goal something tag. From the POM, you can control which goal is executed within the <reportSet> section as follows:

  • No labels