luntbuild + maven + findbugs = OutOfMemoryException
I've been trying to get Luntbuild to generate and publish a project site for our project including a Findbugs report. All other reports (Cobertura, Surefire, JavaDoc, Dashboard) work fine, but Findbugs bails out with an OutOfMemoryException. Excluding findbugs from report generation fixes the build --- although obviously without a Findbugs report.
The funny thing is that I first encountered this problem locally and solved it by setting MAVEN_OPTS=-Xmx512m. This does not seem to be enough in Luntbuild, however: setting that exact same option as an environment variable of my builder doesn't make a difference.
I've found a couple of posts on the 'net stating you should also add -XX:MaxPermSize=512m to MAVEN_OPTS and/or pass -Dmaven.findbugs.jvmargs=-Xmx512m to mvn.bat. None of these (or their combination) seem to help though so any hints would be greatly appreciated!
Cheers, Johannes
Relevant information: Luntbuild is 1.5.6, Maven is 2.1.0, findbugs-maven-plugin is 2.0.1.
This is the Findbugs section of the relevant pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.0.1</version>
</plugin>
This is the head of my build log:
User "luntbuild" started the build
Perform checkout operation for VCS setting:
Vcs name: Subversion
开发者_JS百科Repository url base: http://some.repository.com/repo/
Repository layout: multiple
Directory for trunk: trunk
Directory for branches: branches
Directory for tags: tags
Username: xxxx
Password:xxxx
Web interface: ViewVC
URL to web interface: http://some.repository.com/repo/
Quiet period:
modules:
Source path: somepath, Branch: , Label: , Destination path: somewhere
Source path: somepath, Branch: somewhere1.0.x, Label: , Destination path: somewhere-1.0.x
Source path: somepath, Branch: somewhere1.1.x, Label: , Destination path: somewhere-1.1.x
Update url: http://some.repository.com/repo//trunk
Duration of the checkout operation: 0 minutes
Perform build with builder setting:
Builder name: default
Builder type: Maven2 builder
Command to run Maven2: "C:\maven\apache-maven-2.1.0\bin\mvn.bat" -e -f somewhere\pom.xml -P site -Dmaven.test.skip=false -DbuildDate="Tue Nov 24 11:13:24 CET 2009" -DbuildVersion="site-core138"
-Dsvn.username=xxxx -Dsvn.password=xxxx -DstagingSiteURL=file:///C:/luntbuild/core-reports
-Dmaven.findbugs.jvmargs=-Xmx512m
Directory to run Maven2 in:
Goals to build: site:stage site:stage-deploy
Build properties: buildVersion="site-core138"
artifactsDir="C:\\Program Files\\Luntbuild\\publish\\somewhere\\site-core\\site-core138\\artifacts"
buildDate="Tue Nov 24 11:13:24 CET 2009"
junitHtmlReportDir=""
Environment variables: MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=512m"
Build success condition: result==0 and builderLogContainsLine("INFO","BUILD SUCCESSFUL")
Execute command: Executing 'C:\maven\apache-maven-2.1.0\bin\mvn.bat' with arguments:
'-e'
'-f'
'somewhere\pom.xml'
'-P'
'site'
'-Dmaven.test.skip=false'
'-DbuildDate=Tue Nov 24 11:13:24 CET 2009'
'-DbuildVersion=site-core138'
'-Dsvn.username=xxxxxx'
'-Dsvn.password=xxxxxx'
'-DstagingSiteURL=file:///C:/luntbuild/reports'
'-Dmaven.findbugs.jvmargs=-Xmx512m'
'-DbuildVersion=site-core138'
'-DartifactsDir=C:\\Program Files\\Luntbuild\\publish\\somewhere\\site-core\\site-core138\\artifacts'
'-DbuildDate=Tue Nov 24 11:13:24 CET 2009'
'-X'
'site:stage'
'site:stage-deploy'
Tail of my build log:
Analyzed: C:\luntbuild\somewhere-work\somewhere\...\SomeClass.class
...
Analyzed: C:\luntbuild\somewhere-work\somewhere\...\target\classes
Aux: C:\luntbuild\somewhere-work\somewhere\...\target\classes
Aux: c:\maven\local-repo\...\somejar-1.1.1.1-SNAPSHOT.jar
Aux: c:\maven\local-repo\commons-lang\commons-lang\2.3\commons-lang-2.3.jar
....
Aux: c:\maven\local-repo\org\openoffice\ridl\3.1.0\ridl-3.1.0.jar
Aux: c:\maven\local-repo\org\openoffice\unoil\3.1.0\unoil-3.1.0.jar
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Java heap space
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
java.lang.OutOfMemoryError: Java heap space
at java.util.HashMap.(HashMap.java:209)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis$CachedExceptionSet.(TypeAnalysis.java:114)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.getCachedExceptionSet(TypeAnalysis.java:688)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.computeThrownExceptionTypes(TypeAnalysis.java:439)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.transfer(TypeAnalysis.java:411)
at edu.umd.cs.findbugs.ba.type.TypeAnalysis.transfer(TypeAnalysis.java:89)
at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:356)
at edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory.analyze(TypeDataflowFactory.java:82)
at edu.umd.cs.findbugs.classfile.engine.bcel.TypeDataflowFactory.analyze(TypeDataflowFactory.java:44)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:331)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:281)
at edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory.analyze(CFGFactory.java:173)
at edu.umd.cs.findbugs.classfile.engine.bcel.CFGFactory.analyze(CFGFactory.java:64)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:331)
at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:281)
at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:937)
at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysisNoDataflowAnalysisException(ClassContext.java:921)
at edu.umd.cs.findbugs.ba.ClassContext.getCFG(ClassContext.java:326)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.analyzeMethod(BuildUnconditionalParamDerefDatabase.java:103)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.considerMethod(BuildUnconditionalParamDerefDatabase.java:93)
at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.visitClassContext(BuildUnconditionalParamDerefDatabase.java:79)
at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:68)
at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:971)
at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:222)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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)
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17 minutes 16 seconds
[INFO] Finished at: Tue Nov 24 11:31:23 CET 2009
[INFO] Final Memory: 70M/127M
[INFO] ------------------------------------------------------------------------
Maven2 builder failed: build success condition not met!
Note that apparently maven only uses 70MB... but that probably doesn't mean anything since the Findbugs plugin forks its own process.
I don't have any experience with either of: Luntbuild or maven, but this might help you:
- if the error message is "OutOfMemoryError: Java heap space", then
Xmx
setting is the one for you.-XX:MaxPermSize=512m
option deals with PermGen space, which is a different one. - If, as you mention, FindBugs starts its own process, then setting
MAVEN_OPTS
doesn't seem to be relevant. I would suggest trying to find how to set theXmx
for FindBugs JVM. Probably others will come with details on how to do it.
EDIT:
Documentation for Maven FindBugs Plugin seems to cover the topic of setting heap size. The default value is 512M and you can change it using maxHeap
. The only problem is that it seems to be possible only since version 2.2
.
精彩评论