java - Eclipse 中的 Checkstyle 插件:Checkstyle Execution 由于内部错误而失败
问题描述
我试图弄清楚如何解决这个问题。我安装了面向企业 Java 和 Web 开发人员的 Eclipse Ide,版本 2021-06 (4.20.0) 和 Checkstyle 插件,版本 8.44.0。
编辑:我的 SO 是 ubuntu 20.04.2 LTS
问题是当我创建一个新配置时,无论是从头开始还是从菜单窗口 -> 首选项 -> Checkstyle 复制 Suns Check 配置(这是我的目标,我想要一个像 Suns check 但有一些不同的配置)。然后,创建配置后,我尝试在项目(标准 java 项目)上使用它,方法是右键单击项目、属性并转到 checkstyle,选择“checkstyle active for this project”,然后选择我刚刚的配置从下拉列表中创建。之后,右键单击项目,转到 checkstyle ->“使用 checkstyle 检查代码”会产生以下消息:
由于内部错误,Checkstyle 执行失败,请查看错误日志以了解详细信息...
所以我做了,我去了eclipse日志,发现了以下内容:
>
!ENTRY net.sf.eclipsecs.core 4 0 2021-10-22 23:19:43.102
!MESSAGE Checkstyle-Plugin: unable to parse configuration stream
!STACK 0
com.puppycrawl.tools.checkstyle.api.CheckstyleException: unable to parse configuration stream
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:325)
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:287)
at net.sf.eclipsecs.core.builder.CheckerFactory.createCheckerInternal(CheckerFactory.java:217)
at net.sf.eclipsecs.core.builder.CheckerFactory.createChecker(CheckerFactory.java:122)
at net.sf.eclipsecs.core.builder.Auditor.runAudit(Auditor.java:139)
at net.sf.eclipsecs.core.builder.CheckstyleBuilder.handleBuildSelection(CheckstyleBuilder.java:307)
at net.sf.eclipsecs.core.jobs.RunCheckstyleOnFilesJob.runInWorkspace(RunCheckstyleOnFilesJob.java:119)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.xml.sax.SAXException: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property ${org.checkstyle.sun.suppressionxpathfilter.config} has not been set
com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property ${org.checkstyle.sun.suppressionxpathfilter.config} has not been set
at com.puppycrawl.tools.checkstyle.ConfigurationLoader$InternalLoader.startElement(ConfigurationLoader.java:530)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:518)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183)
at java.xml/com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidator.java:752)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1386)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2725)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:541)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at com.puppycrawl.tools.checkstyle.XmlLoader.parseInputSource(XmlLoader.java:86)
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.parseInputSource(ConfigurationLoader.java:198)
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.loadConfiguration(ConfigurationLoader.java:315)
... 8 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property ${org.checkstyle.sun.suppressionxpathfilter.config} has not been set
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.replaceProperties(ConfigurationLoader.java:376)
at com.puppycrawl.tools.checkstyle.ConfigurationLoader.access$500(ConfigurationLoader.java:51)
at com.puppycrawl.tools.checkstyle.ConfigurationLoader$InternalLoader.startElement(ConfigurationLoader.java:525)
... 23 more
这似乎是 org.checkstyle.sun.suppressionxpathfilter.config 属性的问题,所以我用谷歌搜索它并找到以下页面: https ://checkstyle.sourceforge.io/sun_style.html这说明了默认值 this属性应该有,所以我在属性窗口中为我的配置配置了这个值,但没有任何改变。
这可能是什么原因?我怎么解决这个问题?
解决方案
推荐阅读
- javascript - React JS 路由仅在重新加载时有效
- azure - ValidationError:使用 AzureAD 进行 hapi JS 路由授权时不允许使用“tenantId”
- excel - 如何从对象中的项目中获取值?
- javascript - 带参数的 Azure Cosmos DB 存储过程
- c++ - 删除函数 C++ 中的对象
- mysql - 将 SQL 语句转换为 PySpark
- flutter - 如何修复flutter web TextFormField不接受也不响应输入?
- powershell - 在 PowerShell 中处理文件拖到 BAT 文件
- r - 在 R 包中查找非 ascii 编码的字符
- firebase - Flutter:firebase_auth 好像不行,怎么授权?