gpt4 book ai didi

java - OutOfMemory - Sonar 无法分析项目源代码,也找不到问题

转载 作者:行者123 更新时间:2023-12-02 02:22:10 31 4
gpt4 key购买 nike

我正在 IntelliJ Idea 的 Java 项目中运行插件 SonarLint。

当我请求整个项目的代码分析时,我收到以下消息:

SonarLint 分析失败:Java 堆空间

以下是日志:

Error running SonarLint analysis
java.lang.OutOfMemoryError: Java heap space



java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3181)
at java.util.Vector.grow(Vector.java:266)
at java.util.Vector.ensureCapacityHelper(Vector.java:246)
at java.util.Vector.addElement(Vector.java:620)
at com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.addNode(DOM2DTM.java:247)
at com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:543)
at com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:567)
at com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1142)
at com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:465)
at com.sun.org.apache.xpath.internal.axes.AxesWalker.getNextNode(AxesWalker.java:337)
at com.sun.org.apache.xpath.internal.axes.AxesWalker.nextNode(AxesWalker.java:365)
at com.sun.org.apache.xpath.internal.axes.WalkingIterator.nextNode(WalkingIterator.java:197)
at com.sun.org.apache.xpath.internal.axes.NodeSequence.nextNode(NodeSequence.java:344)
at com.sun.org.apache.xpath.internal.axes.NodeSequence.runTo(NodeSequence.java:503)
at com.sun.org.apache.xml.internal.dtm.ref.DTMNodeList.<init>(DTMNodeList.java:83)
at com.sun.org.apache.xpath.internal.objects.XNodeSet.nodelist(XNodeSet.java:348)
at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.getResultAsType(XPathExpressionImpl.java:364)
at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:110)
at com.sun.org.apache.xpath.internal.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:191)
at org.sonar.java.xml.XmlCheckContextImpl.evaluate(XmlCheckContextImpl.java:82)
at org.sonar.java.xml.XmlCheckContextImpl.evaluateOnDocument(XmlCheckContextImpl.java:76)
at org.sonar.java.checks.xml.spring.SingleConnectionFactoryCheck.scanFileWithXPathExpressions(SingleConnectionFactoryCheck.java:45)
at org.sonar.java.xml.XPathXmlCheck.scanFile(XPathXmlCheck.java:36)
at org.sonar.java.xml.XmlAnalyzer.simpleScanAsXmlFile(XmlAnalyzer.java:107)
at org.sonar.java.xml.XmlAnalyzer.simpleScan(XmlAnalyzer.java:97)
at org.sonar.java.xml.XmlAnalyzer.scan(XmlAnalyzer.java:81)
at org.sonar.plugins.java.XmlFileSensor.execute(XmlFileSensor.java:55)
at org.sonarsource.sonarlint.core.analyzer.sensor.NewSensorsExecutor.executeSensor(NewSensorsExecutor.java:72)
at org.sonarsource.sonarlint.core.analyzer.sensor.NewSensorsExecutor.execute(NewSensorsExecutor.java:63)
at org.sonarsource.sonarlint.core.analyzer.sensor.PhaseExecutor.execute(PhaseExecutor.java:36)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:142)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)

如何增加内存?

最佳答案

Eclipse:运行 --> 运行配置 --> 然后选择maven build 下的项目 --> 然后选择选项卡“JRE"--> 然后输入 -Xmx1024m

运行 --> 运行配置 --> 选择“JRE”选项卡 --> 然后输入-Xmx1024m

我建议您使用profiler检查您需要多少内存,以免分配太多内存。

我错过了 IntelliJ Idea:

您可以获取信息here

请确保您在正确的位置增加了堆。您需要单击 IDEA 的 Ant 工具窗口中的“属性”按钮并编辑“最大堆大小 (Mb)”字段。

关于java - OutOfMemory - Sonar 无法分析项目源代码,也找不到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48356026/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com