简体   繁体   中英

Issue in checkstyle configuration in IntelliJ Idea

My objective is to implement Google's Java Style Checkstyle as stated in https://google-styleguide.googlecode.com/svn-history/r130/trunk/javaguide.html .

In IntelliJ I have enabled Checkstyle plugin and try to point checkstyle xml (downloaded from https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml ).

I got following exception:

Property 'fileExtensions' in module Checker does not exist

although this property is defined in the xml as

<property name="fileExtensions" value="java, properties, xml"/>

Exception details:

org.infernus.idea.checkstyle.exception.CheckStylePluginException:
The CheckStyle rules file could not be loaded.
Property 'fileExtensions' in module Checker does not exist, please check the documentation
at org.infernus.idea.checkstyle.checker.CheckerFactory.blacklistAndShowMessage(CheckerFactory.java:248)
at org.infernus.idea.checkstyle.checker.CheckerFactory.createChecker(CheckerFactory.java:202)

You have run into a version problem. At the time of this writing, the IntelliJ plugin for Checkstyle is still on version 6.1.1, because IntelliJ still runs under Java 6 on MacOS. Checkstyle 6.1.1 is the last Checkstyle version that still used Java 6.

The fileExtensions property was introduced in Checkstyle 6.3. The google_checks.xml of today also makes use of the EmptyCatchBlock check, which was introduced in Checkstyle 6.5.

So, in order to use the Google checks today in IntelliJ, you must use the Checkstyle 6.1.1 based version of google_checks.xml , which may be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM