maven surefire reporting plugin configuration

前端 未结 3 964
[愿得一人]
[愿得一人] 2020-12-17 21:47

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

相关标签:
3条回答
  • 2020-12-17 22:10

    For command line

    mvn surefire-report:report -Daggregate=true
    

    It could be -

    mvn clean test -fn surefire-report:report  -Daggregate=true
    OR
    mvn clean install -fn surefire-report:report  -Daggregate=true
    

    Note : fn -> NEVER fail the build, regardless of project result

    To add in pom

    <aggregate>true</aggregate>
    
    0 讨论(0)
  • 2020-12-17 22:20

    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>
    

    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.

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

    0 讨论(0)
  • 2020-12-17 22:29

    You can add

    <aggregate>true</aggregate>
    

    to the surefire plugin in the parent pom.xml.

    0 讨论(0)
提交回复
热议问题