1

I have researched a lot but still didn't find a satisfying solution. I have a multimodule maven project and want to generate an aggregated report out of the surefire-reports generated by the surefire plugin. By itself everything is working except that I have to run the build process twice.

The requirement is to only run it once. Any ideas?

project (aggregator and parent POM)
|- module1
|- module2
|- module3
|- moduleX

I know the background of the problem (maven creates the reports of the root project before the child project so the aggregation returns empty in the first run) but nearly all (1, 2, 3 4) all state just to re-run the build process. (Also some post on SO point in this direction) The only helpful post was to separate the aggregator and the parent pom. Which however would only be my last resort. Any other ideas how to get aggregated reports in one maven run?

Clarification: To run the build process twice means calling

  1. mvn clean install surefire-report:report (and after its finished call it again)
  2. mvn clean install surefire-report:report

OR

  1. mvn clean site (and after its finished call it again)
  2. mvn clean site

In the first run the aggregated report is empty since it is build before every other project (due to the reactor build order) - so none of the sub-modules has the necessary surefire txt/xml files. In the second run the aggregated report is generated fine, since the surefire reports of the first run are used.

Community
  • 1
  • 1
Lonzak
  • 7,737
  • 5
  • 43
  • 72

1 Answers1

0

Here is my guess:

if you get

[INFO] Skipped "Surefire Report" report (maven-surefire-report-plugin:2.22.0:report-only), file "surefire-report.html" already exists.

on your first run and your second run includes recreating the content of target/site then you'd get the effect that you describe.

http://bartswennenhuis.nl/maven-aggregate-reports-for-multi-module-projects/

on the other hand describes exactly what you see that you need to run the goals twice:

mvn verify site
mvn site:site site:stage
Wolfgang Fahl
  • 12,097
  • 9
  • 75
  • 150