【问题标题】:Maven Checkstyle not workingMaven Checkstyle 不工作
【发布时间】:2017-08-21 12:43:49
【问题描述】:

我在 TreeWalker 模块下的 checkstyle.xml 中设置了以下模块

<module name="NestedIfDepth">
  <property name="max" value="3" />
</module>
<module name="NestedTryDepth">
  <property name="max" value="3" />
</module>

但如果我说编写超过 3 个嵌套的 IF 语句,它不会在我的 maven 安装期间引发 checkstyle 错误

Checkstyle插件在POM中的配置如下:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>2.8</version>
</plugin>

【问题讨论】:

  • 你确定 Maven 正在使用你的 checkstyle.xml 配置文件吗?请提供您在 pom.xml 中使用的 checkstyle 插件配置。
  • org.apache.maven.pluginsmaven-checkstyle-plugin2.8

标签: maven checkstyle


【解决方案1】:

使用Maven Checkstyle Plugin进行自定义检查时,插件需要配置custom checkstyle checker configuration的位置:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-checkstyle-plugin</artifactId>
  <version>2.8</version>
  <configuration>
    <configLocation>[filename for custom checkstyle config file]</configLocation>
  </configuration>
</plugin>

【讨论】:

  • 已经实现了,但是checkstyle还是不行
猜你喜欢
  • 2013-09-27
  • 2012-06-21
  • 2019-12-02
  • 1970-01-01
  • 2018-02-22
  • 1970-01-01
  • 2016-10-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多