【发布时间】:2012-05-07 19:46:05
【问题描述】:
当我运行检查目标时,我似乎无法弄清楚如何让 maven-checkstyle-plugin 向控制台打印警告。
如果我配置为:
<module name="Checker">
<module name="TreeWalker">
<module name="NPathComplexity">
<property name="max" value="5" />
<property name="severity" value="warning" />
</module>
</module>
</module>
...我在控制台中什么也看不到,并且检查没有失败。如果我将严重性更改为错误,则检查失败。
有什么想法吗?我错过了什么吗?
插件配置如下
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<logViolationsToConsole>true</logViolationsToConsole>
<configLocation>
rules.xml</configLocation>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
【问题讨论】:
-
你能用配置显示你的 pom sn-p 吗?
-
你试过运行 mvn clean verify 吗?为什么要配置阶段编译?只需尝试不带阶段的默认设置,然后尝试 mvn clean verify。
-
@khmarbaise 编译是在默认生命周期中验证之前。当它对我的项目有意义时,我可以运行它,阶段不应影响输出。
-
我知道编译是在验证之前,但如果没有影响,我建议准确测试你提到的内容。
标签: maven-plugin maven-3 checkstyle