maven surefire报告插件配置 [英] maven surefire reporting plugin configuration

查看:995
本文介绍了maven surefire报告插件配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多模块maven项目。父pom.xml只是一种引用4个子项目的公共信息的方法。我运行了很多JUnit测试,并且还使用 maven-info-reports-plugin 为Project WebSite设置了父项目。

I have a multi-module maven project. The parent pom.xml is simply a way to reference common information for the 4 subprojects. I have quite a few JUnit tests that run and I also have the Parent Project set up for Project WebSite using the maven-info-reports-plugin.

我在父级中配置了 maven-surefire-report-plugin ,并生成 target / site / surefire-report.html 使用正确的信息在每个子项目中归档。

I have the maven-surefire-report-plugin configured in the parent and it generates the target/site/surefire-report.html file in each of the subprojects with the correct information.

我的问题是当我通过网站运行我的项目网站时:运行我不知道查看项目网站中的任何 surefire-report.html 文件。显示的那个是在父目标目录中,并且没有定义单元测试。

My problem is when I run my project website via site:run I do not see any of the surefire-report.html files in the Project website. The one that shows is in the target directory of the parent and it has no unit tests defined.

有没有办法可以配置 maven-surefire-report -plugin maven-info-reports-plugin 汇总子项目生成的万无一失的报告?

Is there a way I can configure maven-surefire-report-plugin or maven-info-reports-plugin to aggregate the subprojects generated surefire reports?

推荐答案

详细说明Seph的答案。您可以设置许多Maven报告以汇总结果。要使用surefire-report插件执行此操作,您需要执行以下操作:

To elaborate on Seph's answer. You can set many of the Maven reports to aggregate results. To do this with the surefire-report plugin you'd do something like this:

<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-report-plugin</artifactId>
      <version>2.4.2</version>
      <configuration>
        <aggregate>true</aggregate>
        <!--also set this to link to generated source reports-->
        <linkXRef>true</linkXRef>
      </configuration>
    </plugin>
  </plugins>
</reporting>

注意额外的linkXRef属性,这允许你添加对生成的html版本的交叉引用由 jxr插件生成的源代码。 jxr插件也可以设置为聚合,因此这两个组合允许您浏览整个项目结构。

Note the additional linkXRef property, this allows you to add cross-references to the generated html version of the source produced by the jxr plugin. The jxr plugin can also be set to aggregate, so the two combined allow you to browse your entire project structure.

据我所知,maven-info-reports -plugin不进行聚合。

As far as I know, the maven-info-reports-plugin doesn't do aggregation.

这篇关于maven surefire报告插件配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆