zoukankan      html  css  js  c++  java
  • 【转】maven同时使用maven-surefire-report-plugin和maven-surefire-plugin默认将执行两次test

    https://issues.apache.org/jira/browse/SUREFIRE-753

    Here the pom.xml snippet how i configured the report-plugin:

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.9</version>
            <configuration>
              <outputName>failsafe-report</outputName>
              <reportsDirectories>
                <reportsDirectory>${project.build.directory}/failsafe-reports</reportsDirectory>
              </reportsDirectories>
            </configuration>
            <reportSets>
              <reportSet>
                <reports>
                  <report>report-only</report>
                </reports>
              </reportSet>
            </reportSets>
          </plugin>
    

    This means the name of the link in the navigation must be changed as well. May be it's needed to have a supplemental configuration parameter for this or the outputName could be used instead.

    maven-surefire-plugin是maven默认的test执行器。而maven-surefire-report-plugin是site生成test报表的一个插件。maven-surefire-report-plugin默认目标是report,这个将告诉maven执行test,然后搜集surefire-reports下xml生成报告。 而默认mvn site也会执行一次test。所以造成执行两次,解决办法:

    < plugin >
      < groupId >org.apache.maven.plugins< /groupId >
      < artifactId >maven-surefire-report-plugin< /artifactId >
      < version >2.7< /version >
      < reportSets >
        < reportSet >
        < reports >
          < report >report-only< /report >
        < /reports >
        < /reportSet >
      < /reportSets >
    < /plugin >

    将其目标更改report-only,则告诉报表插件,自己不用执行test了,直接使用生命周期里test的执行 surefire-reports结果。bug新颁布已经解决了。

  • 相关阅读:
    C++ 学习笔记
    面向对象
    多线程
    Spring-扫描注解原理,注解自动扫描原理分析
    Eclipse 中报错的阅读顺序
    Eclipse 常用技巧及常见问题解决
    JAVA高级复习-自定义泛型类、泛型接口的注意点
    JAVA高级复习-泛型的使用
    IntelliJ IDEA学习笔记连载一IntelliJ IDEA中创建Maven工程
    JAVA高级复习-多线程的创建方式二
  • 原文地址:https://www.cnblogs.com/shengs/p/5935341.html
Copyright © 2011-2022 走看看