更改Maven surefire-plugin的输出目录 [英] Change output directory of maven surefire-plugin
问题描述
我正在尝试更改由maven项目中的surefire插件生成的XML文件的输出文件夹.我在报告插件的配置括号内以及在maven-site-plugin(在
I'm trying to change the output folder for the XML files which get generated by the surefire-plugin in a maven project. I stated the target output folder inside the configuration brackets of the report-plugin as well as in the maven-site-plugin (mentioned in the documentation). I also tried to state the maven-site-plugin within the reporting block but that doesn't seem to work as well. My XML files always get written into the default surefire-reports folder.
我的pom.xml具有以下条目:
My pom.xml has following entries:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<showSuccess>true</showSuccess>
<outputDirectory>${basedir}/pb-reporting/test-output</outputDirectory>
<!--<skipSurefireReport>true</skipSurefireReport>-->
</configuration>
</plugin> </plugins> </reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<!--<executable>/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95-2.6.4.0.el7_2.x86_64/bin/javac</executable>-->
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
<configuration>
<outputDirectory>${basedir}/pb-reporting/test-output</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin> </plugins> </build>
项目层次结构如下所示:
Project hierarchy looks like this:
任何帮助将不胜感激,在此先感谢您的努力
Any help would be appreciated and thank you in advance for your efforts
推荐答案
在surefire-reports-plugin和maven-site-plugin中配置输出目录是不够的.解决方案是在build块中的maven-surefire-plugin中也声明reportDirectory:
Configuring the output directory in the surefire-reports-plugin and maven-site-plugin isn't enough. The solution is to state the reportsDirectory also in maven-surefire-plugin within the build block :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<reportsDirectory>${basedir}/pb-reporting/test-output</reportsDirectory>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
这篇关于更改Maven surefire-plugin的输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!