Search code examples
anthudsonjenkinsfindbugsjvm-arguments

Increasing maxHeap arg for Findbugs in Jenkins


I am running Findbugs with Ant with the <findbugs> task. I am running the Ant build.xml from Jenkins.

My build is stuck on low heap size : Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.

I have read that I need to run Findbugs with -maxHeap n where n is the size (defaults to 256).

Since I am running Findbugs with Ant and running Ant from Jenkins, I don't really know where to pass this parameter. My options are :

  1. Java Options in Jenkins Ant build step where I usually put parameters like -Xmx1024m -Xms512m etc...
  2. As a jvmargs attribute to <findbugs> task in build.xml file.

I'm not exactly sure how to pass this parameter.


Solution

  • -maxHeap n is a parameter of the findbugs command line wrapper script and can only be used there.

    To set the heap size from an ant script use the jvmargs attribute. So your second option should work. For example:

    <findbugs output="xml" outputFile="..." jvmargs="-Xmx256m">
       ...
    </findbugs>