我正在尝试更改由maven项目中的surefire插件生成的XML文件的输出文件夹。我在报告插件的配置括号内以及在maven-site-plugin(在documentation中提到了)中说明了目标输出文件夹。 我还尝试在报告块中声明maven-site-plugin,但这似乎也不起作用。我的XML文件总是写入默认的surefire-reports文件夹中。
我的pom.xml具有以下条目:
<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>
任何帮助将不胜感激,在此先感谢您的努力
答案 0 :(得分:1)
根据文档,您必须使用reportsDirectory代替不存在的outputDirectory
。
答案 1 :(得分:1)
仅在surefire-reports-plugin和maven-site-plugin中配置输出目录是不够的。解决方案是在build块中的maven-surefire-plugin中也声明reportDirectory:
<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>