findbugs-maven-plugin抛出OutOfMemoryError,如何解决这个问题
java.lang.OutOfMemoryError: Java heap space
at org.apache.bcel.classfile.Constant.readConstant(Constant.java:14
2)
at org.apache.bcel.classfile.ConstantPool.<init>(ConstantPool.java:
67)
at org.apache.bcel.classfile.ClassParser.readConstantPool(ClassPars
er.java:225)
at org.apache.bcel.classfile.ClassParser.parse(ClassParser.java:136
)
at edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngin
e.analyze(JavaClassAnalysisEngine.java:55)
at edu.umd.cs.findbugs.classfile.engine.bcel.JavaClassAnalysisEngin
e.analyze(JavaClassAnalysisEngine.java:43)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysi
s(AnalysisCache.java:213)
at edu.umd.cs.findbugs.classfile.engine.bcel.ClassContextClassAnaly
sisEngine.analyze(ClassContextClassAnalysisEngine.java:46)
at edu.umd.cs.findbugs.classfile.engine.bcel.ClassContextClassAnaly
sisEngine.analyze(ClassContextClassAnalysisEngine.java:38)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysi
s(AnalysisCache.java:213)
at edu.umd.cs.findbugs.ba.AnalysisContext.isTooBig(AnalysisContext.
java:385)
at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:
949)
at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:222)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessor
Impl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethod
AccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.
java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(Invok
erHelper.java:778)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHe
lper.java:758)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(
ScriptBytecodeAdapter.java:170)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(
ScriptBytecodeAdapter.java:198)
at org.codehaus.mojo.findbugs.FindBugsMojo.executeReport(FindBugsMo
jo.groovy:792)
at org.apache.maven.reporting.AbstractMavenReport.generate(Abstract
MavenReport.java:101)
at org.apache.maven.reporting.AbstractMavenReport.execute(AbstractM
avenReport.java:66)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(Default
PluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals
(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStand
aloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(
DefaultLifecycleExecutor.java:539)
答案 0 :(得分:2)
在Windows机器上,以下命令将增加Maven可用的最大内存量(分别为heap和permGen):
set MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=512m
答案 1 :(得分:1)
您还可以使用-maxHeap
将堆大小传递给FindBugs