0

I'm having problem running Sonar analysis through Jenkins. Using a Post Step with "Invoke Standalone Sonar Analysis" to start a Sonar Runner task. I can see the result from the analysis in the dashboard but the build in Jenkins never ends. It seems that the cleanup task in Sonar hangs. I am using H2 database and CANNOT change to other databases.

Jenkins is installed in Linux machine and is Sonar version is 3.7.4

How to resolve that clean snapshot hang part?

halfer
  • 19,824
  • 17
  • 99
  • 186
user3626234
  • 171
  • 1
  • 3
  • 13

2 Answers2

1

H2 database is not supported for production environments (but you seem to be aware of this fact). Furthermore, it is preventing you from upgrading to a recent version of SonarQube, since database migrations are not supported either on H2.

That being said, and if losing your project history is not important, you can try to switch to a recent SQ server and runner (respectively 4.4 and 2.4 as of writing), as there were quite a few improvements and bug fixes since last year.

Mithfindel
  • 4,553
  • 1
  • 23
  • 32
  • Thank you so much for your advise.Will it resolve the hang part "clean Snapshot" ?? when i debug it it shows some semaphores values are updating - Committing JDBC Connection [jdbc:h2:tcp://localhost/sonar, UserName=SONAR, H2 JDBC Driver] 12:36:00.708 DEBUG - Resetting autocommit to true on JDBC Connection [jdbc:h2:tcp://localhost/sonar, UserName=SONAR, H2 JDBC Driver] 12:36:00.708 DEBUG - Closing JDBC Connection [jdbc:h2:tcp://localhost/sonar, UserName=SONAR, H2 JDBC Driver] – user3626234 Aug 29 '14 at 22:13
  • Hi Mithfindel,I am able pass and its working using sonar 4.4.thanksI am invoking SonarQube analysis from Jenkins and able to get the Unit Test Success Percentage but not able to see the Unit Tests coverage??? Can anyone please help in getting this in Sonar dashboard?What parameter should I add while invoking from Jenkins?Please let know for both Windows and Linux machines? – user3626234 Aug 31 '14 at 20:01
  • Using a combination of http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin and http://www.eclemma.org/jacoco/trunk/doc/ant.html should get you up and running (use Ant to generate jacoco.exec, then import in into SQ) – Mithfindel Sep 01 '14 at 06:43
  • exec? i am using linux server..how to do that then as exec file is not allowed – user3626234 Sep 07 '14 at 16:00
  • exec, not exe. It's Jacoco's result file. – Mithfindel Sep 07 '14 at 19:00
1

H2 is not recommended for production as in sonar documentation stated. But if you are not awared of the history of sonar analysis, you can do the following (keep on using H2):

In Linux:

  1. Stop sonar: service sonar stop
  2. Delete sonar*.db under /opt/sonar/data
  3. Start sonar again: service sonar start
  4. Then run analysis again.

It should work, good luck.

halfer
  • 19,824
  • 17
  • 99
  • 186
Tim Long
  • 2,039
  • 1
  • 22
  • 25