使用 maven-checkstyle-plugin 时如何抑制 maven 输出中的警告?
How to suppress warnings in maven output when using maven-checkstyle-plugin?
我的构建因 checkstyle 错误(不是警告)而失败。只要有任何 checkstyle 错误,我希望警告不会显示在(maven 生成的)输出中。如何实现?
# First is error, should be reported, second is a warning, should not be reported in the maven output.
...data/Decimal.java:286:31: '7L' is a magic number.
.../data/Decimal.java:296:5: warning: Missing a Javadoc comment.
更新:查看我的评论。这个问题与抑制特定警告无关!这只是关于不在 maven 输出中显示所有警告!
checkstyle中没有这个选项。
您可以使用过滤器仅显示错误,但如果存在更高级别,则无法按级别隐藏事件。你可以写这样的过滤器 http://checkstyle.sourceforge.net/writingfilters.html#Writing_Filters
有很多警告的相同问题。作为一个快速的技巧,可以过滤掉 "warning" 行与反向 grep 匹配:
mvn clean install | grep -v warning
我的构建因 checkstyle 错误(不是警告)而失败。只要有任何 checkstyle 错误,我希望警告不会显示在(maven 生成的)输出中。如何实现?
# First is error, should be reported, second is a warning, should not be reported in the maven output.
...data/Decimal.java:286:31: '7L' is a magic number.
.../data/Decimal.java:296:5: warning: Missing a Javadoc comment.
更新:查看我的评论。这个问题与抑制特定警告无关!这只是关于不在 maven 输出中显示所有警告!
checkstyle中没有这个选项。
您可以使用过滤器仅显示错误,但如果存在更高级别,则无法按级别隐藏事件。你可以写这样的过滤器 http://checkstyle.sourceforge.net/writingfilters.html#Writing_Filters
有很多警告的相同问题。作为一个快速的技巧,可以过滤掉 "warning" 行与反向 grep 匹配:
mvn clean install | grep -v warning