【发布时间】:2016-10-15 23:16:17
【问题描述】:
在默认配置之后,maven 只为源类输出Checkstyle report,而不是 Junit 测试类。请注意,我不是在寻找万无一失的测试报告输出。
来自 pom.xml:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<configLocation>src/main/resources/apcheckstyle.xml</configLocation>
<module name="LineLength">
<property name="max" value="120"/>
</module>
</configuration>
</plugin>
</plugins>
我将 junit 的依赖范围从 test 更改为 compile:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>
Maven 被配置为使用 mvn 站点插件生成 checkstyle 报告。 我尝试将用户属性 includeTestResources 添加为 true,但这没有帮助。文档说明默认值为true,所以我把它拿出来了。
这是检查样式生成期间的 maven 输出。
来自 javadocs:
正在生成 C:\Users\Administrator\Projects\lht657aws\target\site\testapidocs\help-doc.html...
checkstyle 插件运行:
[INFO] 生成“Checkstyle”报告 --- maven-checkstyle-plugin:2.17
[INFO] Checkstyle 6.11.2 使用 src/main/resources/apcheckstyle.xml 规则集报告了 210 个错误。
正在关注问题-? src 下的所有 java 都被处理,只是被测试的 java 被跳过:
[警告] 无法找到要链接到的源外部参照 - 已禁用
checkstyle 后,maven 项目信息报告开始
[INFO] 生成“依赖项”报告 --- maven-project-info-reports-plugin:2.9
【问题讨论】:
-
编辑澄清这实际上是关于 checkstyle 报告并添加了来自 Maven 的输出。
标签: maven junit checkstyle