我不确定这是否是一个简单的问题,但我想在测试阶段确保生成html格式的输出文件(除了xml和txt格式的输出文件).
我试图通过为build> surefire添加一个'executions'条目来实现这一点.这是正确的位置吗?如果是这样,我做错了吗?
<build>
..
<plugins>
..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>site</outputDirectory>
</configuration>
<executions>
<execution>
<id>during-tests</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
Pas*_*ent 20
我想在测试阶段确保生成html格式的输出文件(除了xml和txt格式的输出文件).
最简单的方法(不运行site)可能只是调用:
mvn surefire-report:report
Run Code Online (Sandbox Code Playgroud)
这将在生成报告之前运行测试(但结果不是很好,因为不会生成CSS,您必须为此运行site).
我试图通过为build> surefire添加一个'executions'条目来实现这一点.这是正确的位置吗?如果是这样,我做错了吗?
如果你真的想将surefire-report插件绑定到test阶段,我的建议是使用report-only目标(因为它不会重新运行测试,请参阅SUREFIRE-257),如下所示:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>report-only</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
作为旁注,生成报告作为网站的一部分:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)
跑步
mvn test site
Run Code Online (Sandbox Code Playgroud)
似乎没有那么慢(我只使用Maven 3,仅使用此报告)并产生更好的结果.如果你有一个复杂的站点设置,这可能不是一个选项(至少不会通过引入配置文件使事情变得更复杂).
| 归档时间: |
|
| 查看次数: |
27724 次 |
| 最近记录: |