Search code examples
intellij-ideacheckstylesuppress-warnings

Checkstyle: how to disable Missing package-info.java file?


Can I disable somehow Checkstyle warning?

Missing package-info.java file.

My IDE is IntelliJ IDEA.


Solution

  • If you haven't configured anything yet, and you are using IntelliJ, this means you are using the Sun checks configuration. You may not like this answer, but don't shoot the messenger ...

    • Download a copy of sun_checks.xml. Make sure that you modify the Checkstyle version in the URL to the one you are using (important!). To find out the version, select the Checkstyle-IDEA plugin in IntelliJ's Plugins dialog; it gives the version number in the description text.
    • Remove the <module name="JavadocPackage">...</module> from the XML.
    • Configure the resulting file as a new Checkstyle configuration and use that.

    There is currently (as of Checkstyle 7.1.1) no other way to disable a rule from the standard configuration.

    If you just want to suppress a single violation, or a group of violations, you may also consider the many suppression configuration options. In order to suppress one rule entirely, you would still have to change the XML, so the above method is better.