I’ve developed a Maven reporting plugin for internal use at our company. It’s designed to work in standalone mode so that it can be run against a given project without having to be configured in the <reporting> section of the pom.
However, the format of the document is currently in xhtml and all of our project docs are currently stored on Confluence. It would be a great convenience to generate the document in Confluence markup. There already exist ConfluenceSink and ConfluenceSinkFactory classes that would generate the proper markup, but I don’t see an obvious way to set the sinks used by subclasses of AbstractMavenReport.
The approach I’m currently taking is:
- Overriding the
executemethod as this currently hardcodes the use ofSiteRendererSink, which outputs xhtml. - Finding an alternative to
SiteRenderer.generateDocument(), as this method requires the above-mentionedSiteRendererSink.
Has anyone tackled these issues? Appreciate the feedback.
Finally, can I just note for the record that the API documentation for Maven is atrocious? I don’t need a hand-holding tutorial — just some basic javadocs and a sprinkling of insightful comments would be a huge help in getting anything done with this codebase.
So I managed to cook up a working solution. I was on the right track, I was just making things more complicated than they needed to be — again, better documentation would have saved me sifting through various plugins looking for an example.
So, if anyone wants to do something similar, first get your plugin working at producing xhtml. I found this link to be fairly helpful in that regard. To change the output format, you’ll have to override the
execute()method and provide thegenerate()method with the appropriateSinkandSinkFactoryimplementations.Here’s an example for output in Confluence markup: