You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by yurodivuie <yu...@gmail.com> on 2011/02/11 00:12:22 UTC

maven-surefire-report-plugin: reportsDirectories does not change directory searched by plugin.

I've been trying to generate reports for my failsafe tests using the
maven-surefire-report-plugin (v2.7.2), using the instructions posted in the 
http://maven.apache.org/plugins/maven-failsafe-plugin/usage.html#Reporting_integration_test_results
failsafe usage guide.   However, every time I ran the report, the results
were from my surefire tests instead of my failsafe tests.

Reading the 
http://maven.apache.org/plugins/maven-surefire-report-plugin/report-only-mojo.html
plugin documentation , I see that reportsDirectories (which supplies the
location of the failsafe reports) is a replacement for the deprecated
reportsDirectory optional parameter.  I tried using reportDirectory instead,
and the correct failsafe report appears.

Here's my successful attempt at using the plugin with reportsDirectory, with
the original attempt at using reportsDirectories commented out:

 <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.7.2</version>
        <reportSets>
          <reportSet>
            <id>integrations-tests</id>
            <reports>
              <report>report-only</report>
            </reports>
            <configuration>
              <outputName>failsafe-report</outputName>
             
<reportsDirectory>${project.build.directory}/failsafe-reports/</reportsDirectory>
              <!--<reportsDirectories>
               
<reportsDirectory>${project.build.directory}/failsafe-reports/</reportsDirectory>
              </reportsDirectories>-->
            </configuration>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>

My question is this: has anyone else experienced this problem with setting
the report directory, or am I misconfiguring the plugin?



Note:  I suspect this may be caused by a bug in the SurefireReportMojo code,
excerpted here:

137     public void executeReport( Locale locale )
...
142         if ( reportsDirectory != null )
143         {
144             if ( reportsDirectories != null )
145             {
146                 reportsDirectoryList.addAll( Arrays.asList(
reportsDirectories ) );
147             }
148             reportsDirectoryList.add( reportsDirectory );
149         }

It looks like the old parameter is required to read the new parameter; see
the bolded variables.  If this fails, and the reportsDirectoryList isn't
populated, the report instead looks in the default Surefire report
directory.
-- 
View this message in context: http://maven.40175.n5.nabble.com/maven-surefire-report-plugin-reportsDirectories-does-not-change-directory-searched-by-plugin-tp3380368p3380368.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org