Reputation: 543
I tried adding this code to my pom.xml
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.12.4</version>
<configuration>
<outputDirectory>D:/eclipse_ws/reports</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>2.1</version>
<configuration>
<outputDirectory>D:/eclipse_ws/reports</outputDirectory>
</configuration>
</plugin>
</plugins>
and executing this in windows command prompt
mvn surefire-report:report -DoutputDirectory=D:/eclipse_ws/reports
I am still getting the surefire-report.html report in the target/site/ folder itself. Is it possible to change the directory in the way I did? Did I make any mistake?
Upvotes: 4
Views: 2566
Reputation: 11
The configuring the output location for surefire report from report plugin doc seems to be indeed wrong.
I found on this doc page
description of <xrefLocation>
parameter of surefire-report:report
goal, which refers to ${project.reporting.outputDirectory}
value. I tried in my pom.xml and it worked:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
</plugins>
<outputDirectory>${basedir}/new-reports-dir</outputDirectory>
</reporting>
Upvotes: 1
Reputation: 3502
The official documentation suggests that the configuration similar to OP's should work, but it doesn't.
What worked for me is:
<project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<reportsDirectory>C:/eclipse_ws/reports</reportsDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
A relative path works as well. Also you don't need to specify the directory as a command line parameter because you already did it in the configuration.
Upvotes: 0