rmuller
rmuller

Reputation: 12869

How to suppress warnings in maven output when using maven-checkstyle-plugin?

My build fails on checkstyle errors (not warnings). As long as there are any checkstyle errors i want the warnings are not shown in the (maven produced) output. How to achieve this?

# 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.

UPDATE: See my comment. This question is NOT about suppressing specific warnings! It is only about not displaying all warnings in the maven output!

Upvotes: 6

Views: 19162

Answers (2)

Anton Lavrenov
Anton Lavrenov

Reputation: 79

Had the same problem with lots of warnings. As a quick hack it is possible to just filter out "warning" lines with inverted grep match:

mvn clean install | grep -v warning

Upvotes: 5

Roman Ivanov
Roman Ivanov

Reputation: 2537

There is no such option in checkstyle.

You can use filters to show you only errors, but there is no option to hide events by level if higher level exists. You can write such filter http://checkstyle.sourceforge.net/writingfilters.html#Writing_Filters

Upvotes: 5

Related Questions