Error using checkstyle/google_checks.xml with maven-checkstyle-plugin

ccDict picture ccDict · Dec 7, 2014 · Viewed 9.7k times · Source

I am trying to use checkstyles google_checks.xml with maven-checkstyle-plugin. If I use the google_checks.xml with the latest checkstyle intelliJ plugin everything is correct but when I try configurating it via maven-checkstyle plugin I get this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.13:check (default-cli) on project XX_XX_XX: Failed during checkstyle configuration: cannot initialize module TreeWalker - Unable to instantiate AvoidEscapedUnicodeCharacters:
Unable to instantiate AvoidEscapedUnicodeCharactersCheck 

My pom.xml looks like this:

   <project xmlns="http://maven.apache.org/POM/4.0.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties>
    [...]
    <checkstyle.file.path>develop/checkstyle/google_checks.xml</checkstyle.file.path>
</properties>
[...]
<build>
    <plugins>
        [...]
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.13</version>
            <configuration>
                <configLocation>${checkstyle.file.path}</configLocation>
                <failOnViolation>false</failOnViolation>
            </configuration>
        </plugin>
    </plugins>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.9.1</version>
            <configuration>
                <configLocation>${checkstyle.file.path}</configLocation>
                <failOnViolation>false</failOnViolation>
            </configuration>
        </plugin>
    </plugins>
</reporting>

Do you guys have some suggestions about what could be wrong?

Answer

ccDict picture ccDict · Dec 8, 2014

fixed this by updating the checkstyle-dependency manually to the latest stable version:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-checkstyle-plugin</artifactId>
            <version>2.13</version>
            <dependencies>
                <dependency>
                    <groupId>com.puppycrawl.tools</groupId>
                    <artifactId>checkstyle</artifactId>
                    <version>${checkstyle.latest.version}</version>
                </dependency>
            </dependencies>
            <configuration>
                <configLocation>${checkstyle.file.path}</configLocation>
                <failOnViolation>false</failOnViolation>
            </configuration>
        </plugin>