Pen*_*eer 8 integration-testing unit-testing maven-plugin maven maven-surefire-plugin
我有一些单元测试(src/test 文件夹中的 *Test.java 类,由 Surefire 插件执行)和其他一些集成测试(src/it 文件夹中的 *IT.java 类,由 Failsafe 插件执行):.xml 和 .txt当我运行
mvn install
.
此外,我想要 html 报告:我认为最好的解决方案应该是使用mvn site
,以便也有 CSS 文件。
然而,现在只执行单元测试,所以只生成目标/surfire-reports,显然生成的唯一 html 文档是关于单元测试的。
下面的 POM 片段:
<build>
...
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
...
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
...
<goal>integration-test</goal>
<goal>verify</goal>
...
</plugin>
<plugin>
// definition of build helper maven plugin for the registration
// of the src/it folder
</plugin>
...
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.maven.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.19.1</version>
</plugin>
</plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)
显然,mvn site
不执行集成测试目标,但我该如何解决?
PS:一个愚蠢的解决方案是在 mvn install 之后运行 mvn site(没有清理),但我想要更聪明的东西。
小智 0
共有三个内置构建生命周期:默认、干净和站点。默认生命周期处理项目部署,干净生命周期处理项目清理,而站点生命周期处理项目站点文档的创建。
所以命令应该是:
mvn clean verify site
Run Code Online (Sandbox Code Playgroud)
(除非有特殊要求,否则请始终清洁您的工作空间)