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

11,402

Solution 1

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

Solution 2

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
Share:
11,402

Related videos on Youtube

rmuller
Author by

rmuller

During the last 15 years transformed slowly from a business consultant and senior line manager into a software engineering geek :) Special interests: All facets of managing Product Data in commercial environments (mostly supply side), both technical and organisational related. In depth knowledge of and experience with: Product Information Management (PIM). Heiler (now Informatica), Stibo, Hybris (now SAP), Riversand and many other mid market products (Product) Data Quality, including "smart" data cleansing and data enrichment (Product) Classification systems (like ETIM, eClass) (Product) Search, especially faceted search (primarily Lucene, but also Elastic Search and SOLR) Semantic Web (SPARQL) Data Integration/Migration. ESB's (Specialized in Apache Camel), EDIINT Base technology: Java XML, XSLT, XSL:FO (XEP, Apache FOP), XML Schema, JAXB Web Services, REST, HATEOAS (dislike: BIG Web Services / SOAP) Vaadin (The best WebUI framework I know) Databases. Favorites: PostgreSQL (traditional), H2Database (embedded), NoSQL (Neo4J), MapDB (low level) Ansible Linux (favorite: Debian)

Updated on September 15, 2022

Comments

  • rmuller
    rmuller over 1 year

    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!

  • rmuller
    rmuller almost 9 years
    I already came to this conclusion myself. Good to have this confirmed! Tried SeverityMatchFilter and it comes close, but is not exactly where i am looking for.