Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a maven reporting plugin to generate report with the doxia API?

I've been trying to write my own maven reporting plugin to generate info about tests when running 'mvn site'. The file test_report.html is created by the code below, but the page does not contain any title or text with the doxia sink API.

public class TestDocMojo extends AbstractMavenReport {

  public String getOutputName() {
      return "test_report";
  }

  public void executeReport(Locale locale) throws MavenReportException {
    Sink sink = getSink();
    sink.head();
    sink.title("My maven site report");
        sink.text("Content here.");
    sink.flush();
    sink.close();
  }
}

I have been looking at this example: http://docs.codehaus.org/display/MAVENUSER/Write+your+own+report+plugin

like image 662
thomasfl Avatar asked Jan 21 '26 18:01

thomasfl


1 Answers

you've made some small mistakes. Mainly closing stuff out.

  1. title() just opens to the title for writing in doxia.

        sink.title();
        sink.text("Hello");
        sink.title_();
    

Will write the title.

Now for the body.

        sink.body();
        sink.rawText("Hello World");
        sink.body_();

Finally the full example :-

        Sink sink = getSink();
        sink.head();
        sink.title();

        sink.text("Hello");
        sink.title_();
        sink.head_();

        sink.body();
        sink.rawText("Hello World");

        sink.body_();
        sink.flush();
        sink.close();
like image 128
MikePatel Avatar answered Jan 24 '26 09:01

MikePatel