如何使用 doxia API 获取 Maven 报告插件来生成报告?
我一直在尝试编写自己的 Maven 报告插件,以在运行“mvn site”时生成有关测试的信息。这 文件 test_report.html 是由下面的代码创建的,但该页面不包含任何 doxia 接收器 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();
}
}
我一直在看这个例子: http://docs.codehaus .org/display/MAVENUSER/Write+your+own+report+plugin
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你犯了一些小错误。主要是把东西关掉。
title() 只是打开在 doxia 中书写的标题。
会写标题。
现在来说说身体。
最后是完整的例子:-
you've made some small mistakes. Mainly closing stuff out.
title() just opens to the title for writing in doxia.
Will write the title.
Now for the body.
Finally the full example :-
我认为这个问题的最佳答案是您阅读报告插件的几个工作示例的源代码。 “经典”是 maven-project-info-reports-plugin 的一部分,还有很多其他的。您可以在以下位置找到其来源:
当您弄清楚您错过了什么时,请改进 codehaus 文档。
I think that the best answer to this question is for you to read the source of several working examples of reporting plugins. The 'classics' are part of the maven-project-info-reports-plugin, and then there are lots of others. You can find the source of that at:
When you figure out what you missed, please improve the codehaus doc.