shekhar verma
shekhar verma

Reputation: 499

Sonar - OutOfMemoryError Java Heap Space while running sonar through jenkins

I am using jenkins for making build by using Ant. I am also configuring sonar on this jenkins job via 'Invoke Standalone Sonar Analysis". Everything is going fine till build making process and build successfully created. Now sonar execution is started and after some time i got an error

"Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: java.lang.OutOfMemoryError: Java heap space

Build step 'Invoke Standalone Sonar Analysis' marked build as failure "...

What all i have done to fix this issue are:

  1. Increasing java heap size via

    Replaced %SONAR_RUNNER_OPTS% with -Xms256m -Xmx1024m in sonar-runner.bat file of sonar.

  2. Modify Sonar_Way quality profile and put only one or two rules active in this so that to avoid rule voilation.

then run build but still getting same java heap error. One more thing i would add on this is my project source folder size is around 40mb means its a big project comparatively.

Can anyboby help me out on this?? What else should i do to get this done. Your revert will be appreciable.. Thanks in Advance..

Upvotes: 2

Views: 12239

Answers (1)

Here are some other things you can try:

  • Remove all the following addionnal plugins: PDF, build-breaker, quality-index, technical debt. And try a new analysis.

  • Increase again the Java heap size (-Xms512m -Xmx1024m)

  • Use "sonar.exclusions" to exclude parts of your code, and see the max amount of source code that you can analyse at once without failing

  • Split your big project into small modules and use the multi-module feature of Sonar

Upvotes: 2

Related Questions