Maven surefire plugin configuration

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

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

My problem is when I launch my project website through the site: run . I do not see any surefire-report.html files on the Project website. The one that displays is in the parent's target directory and does not have specific unit tests.

Is there a way to configure maven-surefire-report-plugin or maven-info-reports-plugin to aggregate prepared subprojects of confidence reports?

+7
java maven-2 surefire
source share
3 answers

Develop Sef's answers. You can configure many Maven reports to aggregate results. To do this with the surefire-report plugin, you would 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> 

Pay attention to the additional linkXRef property, this allows you to add cross-references to the generated html version of the source created by jxr plugin . The jxr plugin can also be configured for aggregation, so these two combinations allow you to view the entire structure of the project.

As far as I know, the maven-info-reports plugin does not perform aggregation.

+28
source share

You can add

 <aggregate>true</aggregate> 

into the surefire plugin in the parent pom.xml.

+2
source share

For the command line -

 mvn surefire-report:report -Daggregate=true 

Maybe -

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

Note: fn β†’ NEVER complete the assembly, regardless of the project result

0
source share

All Articles