![](/img/trans.png)
[英]maven-checkstyle-plugin not working with google_checks.xml on macOS
[英]Error using checkstyle/google_checks.xml with maven-checkstyle-plugin
我正在尝试使用checkvenles google_checks.xml和maven-checkstyle-plugin 。 如果我将google_checks.xml与最新的checkstyle intelliJ插件一起使用,一切都是正确的,但是当我尝试通过maven-checkstyle插件进行配置时,我收到此错误:
[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
我的pom.xml看起来像这样:
<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>
你们有什么可能是错的建议吗?
通过手动更新checkstyle-dependency到最新的稳定版本来修复此问题:
<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>
Maven checkstyle插件使用checkstyle 5.7(插件描述的第一行)。
Checkstyle 5.7没有这个检查(请参阅grepcode上的检查包 )。
您需要禁用此检查或等待MCHECKSTYLE-261的官方修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.