Intellij中Checkstyle扫描期间的异常

问题描述 投票:0回答:1

我安装了Checkstyle-Idea插件,导入了checkstyle文件,并使用下拉菜单中的规则运行了扫描。我遇到了以下例外:

Unexpected Exception Caught
The scan failed due to an exception: Exception was thrown while processing /dir/.../Test.java
                Root cause:
                'other' is different type of Path
                java.lang.IllegalArgumentException: 'other' is different type of Path
                at java.base/sun.nio.fs.UnixPath.relativize(UnixPath.java:429)
                at java.base/sun.nio.fs.UnixPath.relativize(UnixPath.java:43)
                at com.puppycrawl.tools.checkstyle.utils.CommonUtil.relativizeAndNormalizePath(CommonUtil.java:382)
                at com.puppycrawl.tools.checkstyle.Checker.acceptFileStarted(Checker.java:366)
                at com.puppycrawl.tools.checkstyle.Checker.processFiles(Checker.java:283)
                at com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:216)
                at org.infernus.idea.checkstyle.service.cmd.OpScan.processAndAudit(OpScan.j... (show balloon)

[在互联网上其他任何地方都没有这种例外的痕迹,这很可怕。我使用的是8.28版本,但是我尝试使用其他旧版本并遇到相同的问题。当我导入checkstyle文件时,它要求我在checkstyle文件中定义的basedi和抑制规则属性。我在两个字段中都输入了空字符串“”。

以前有人遇到过吗?

java intellij-idea checkstyle intellij-plugin
1个回答
0
投票

我在使用checkstyle + gradle时遇到了类似的问题,发现这是因为我为basedir属性使用了相对路径。将其更改为绝对路径应该起作用(reference);

<!-- Doesn't work -->
<module name="Checker">
  <property name="basedir" value="someDirectory" />

<!-- Works -->
<module name="Checker">
  <property name="basedir" value="/home/myuser/someDirectory" />
© www.soinside.com 2019 - 2024. All rights reserved.