views:

445

answers:

2

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 I also have the Parent Project set up for Project WebSite using the maven-info-reports-plugin.

I have the maven-surefire-report-plugin configured in 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 run my project website via site:run I do not see any of the surefire-report.html files in the Project website. The one that shows is in the target directory of the parent and it has no unit tests defined.

Is there a way I can configure maven-surefire-report-plugin or maven-info-reports-plugin to aggregate the subprojects generated surefire reports?

+1  A: 

You can add

<aggregate>true</aggregate>

to the surefire plugin in the parent pom.xml.

Seph
+2  A: 

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.

Rich Seller
Excellent that worked. Thank you very much you saved me a lot of investigative time. I love Stackoverflow.com
Peter Delaney