1

我正在尝试使用如下所示的 spotbugs-maven-plugin

<build>
...
<plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>3.1.0-RC8</version>
        <configuration>
                <plugins>
                        <plugin>
                            <groupId>jp.skypencil.findbugs.slf4j<groupId>
                            <artifactId>bug-pattern</artifactId>
                            <version>1.2.4</version>
                        </plugin>
                </plugins>
                <includeFilterFile>./spotbugIncludeFilter.xml</includeFilterFile>
                <onlyAnalyze>com.vnera.-</onlyAnalyze>
                <argLine>-Xmx1024m</argLine>
        </configuration>
</plugin>
</build>

但是每次它都因以下错误而失败

[INFO] Fork Value is true
     [java] Out of memory
     [java] Total memory: 482M
     [java]  free memory: 43M

Stacktrace 如下所示

[java]  at java.util.ArrayList.<init>(ArrayList.java:152)
[java]     at edu.umd.cs.findbugs.ba.Frame.<init>(Frame.java:113)
[java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.<init>(ValueNumberFrame.java:90)
[java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:181)
[java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:58)
[java]     at edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis.lookupOrCreateFact(BasicAbstractDataflowAnalysis.java:185)
[java]     at edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis.getStartFact(BasicAbstractDataflowAnalysis.java:70)
[java]     at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:234)
[java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:76)
[java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:46)
[java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:369)
[java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:322)
[java]     at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:1005)
[java]     at edu.umd.cs.findbugs.ba.ClassContext.getValueNumberDataflow(ClassContext.java:336)
[java]     at edu.umd.cs.findbugs.detect.FindInconsistentSync2.analyzeMethod(FindInconsistentSync2.java:638)
[java]     at edu.umd.cs.findbugs.detect.FindInconsistentSync2.visitClassContext(FindInconsistentSync2.java:413)
[java]     at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
[java]     at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1079)
[java]     at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:280)
[java]     at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:401)
[java]     at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1187)

我也试过设置<argLine>-XX:MaxPermSize=1024m</argLine>。仍然得到同样的错误。

有人可以让我知道我该如何解决这个问题吗?

  • 爪哇 8
  • Maven 3
4

1 回答 1

4

你看过maxHeap吗?这应该有助于增加您的内存问题。

同样来自他们的常见问题解答它指出:

您可以使用 -maxHeap n 选项增加此值,其中 n 是要分配的堆空间的兆字节数。

于 2017-12-06T19:48:33.703 回答