9

I have a maven based project. There are four different projects like shown in the structure below. Each main project and the subprojects have their own pom.xml files.

ProjectA
    |
    --------subProjects     
ProjectB  
   |
   --------subprojects
ProjectC    
   |
   --------subProjects
ProjectD
   |
    -------subprojects

I am running mvn site on ProjectC which is dependent on ProjectB which is inter-dependent on ProjectA and ProjectB

So when i run maven site all the test results for all these projects get created individually. What I would also like to do is to create a aggregation of all the test results in these projects and sub-projects and show it in one place.

So is it possible with maven site?

Lawrence Leung
  • 305
  • 1
  • 10
Sam
  • 1,278
  • 4
  • 29
  • 59

2 Answers2

2

Yes. There are two options:

  1. "You can do this by setting project.build.directory on all of your projects to a common folder."

  2. You can add extra directories to the maven-surefire-report-plugin by adding an reportsDirectories element with reportsDirectory children (documentation).

So this should work:

<reportsDirectories>
    <reportsDirectory>../ProjectA/target/surefire-reports</reportsDirectory>
    <reportsDirectory>../ProjectA/module1/target/surefire-reports</reportsDirectory>
    ...
</reportsDirectories>
Community
  • 1
  • 1
Aaron Digulla
  • 297,790
  • 101
  • 558
  • 777
  • Should this be added only to the parent pom? – Sam Feb 13 '13 at 11:46
  • #1 can be added just to the parent pom, the second can't be because these settings would be used for each module. But then, I'd create a completely new project for the second approach which just aggregates test results. – Aaron Digulla Feb 13 '13 at 12:55
1

A bit different approach would be to see test results in specialized servers like Jenkins or Sonar. This way no need to modify existing projects.

See running examples at https://builds.apache.org/ and https://analysis.apache.org/

Two screenshot from Sonar: Test results

Result by module and package Test results by module & package

For Jenkins there is Dashboard View Plugin enter image description here

Paul Verest
  • 51,779
  • 39
  • 174
  • 288