【发布时间】:2019-03-25 09:31:51
【问题描述】:
我尝试在 Maven 和 Eclipse 中使用相同的 Checkstyle 配置文件。模块 SuppressionCommentFilter 在 Eclipse 中按预期工作,但 Maven 报告 TreeWalker 不允许作为 SuppressionCommentFilter 的父级 如果我将它从 TreeWalker 移动到 Checker,错误就会消失,但 Checkstyle 不会处理忽略 cmets。我在 Eclipse 中使用 Checkstyle 8.12,但没有找到将 6.18 以外的其他方法与 Maven 一起使用。由于这个模块自 3.5 以来一直是 Checkstyle 的一部分,我不明白这可能是什么问题。有什么建议吗?
<module name="Checker">
<property name="severity" value="warning" />
<module name="TreeWalker">
<property name="tabWidth" value="4" />
<module name="SuppressionCommentFilter" />
马克问它是什么样子的,所以这是那段代码。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>verify-style</id>
<phase>process-classes</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
除了
之外,pom 和 Checkstyle 配置文件都工作正常
如果它是 Treewalker 的子节点,我会从 Maven 插件中得到错误,但不会从 Eclipse 插件中得到错误,但是我只能让它与 Eclipse 插件一起使用。
【问题讨论】:
-
你的
pom.xml中有什么checkstyle版本?
标签: eclipse maven checkstyle