Search code examples
unit-testingmavenjenkinscode-coveragesonarqube

Sonarqube 4.3 dont trigger Cobertura unit test execution on Jenkins


we had SonarQube v3.4 and recently upgraded to SonarQube V4.3. Also we use Jenkins to build and trigger sonar analysis on Maven projects and Cobertura as the code coverage tool.

In the version 3.4, Sonar used to trigger (with Jenkins) the cobertura execution and collect the data, but when we upgraded to Sonar 4.3, there was no option in Sonar to select the default code-coverage tool, the Jenkins Sonar execution no longer triggers cobertura and unit test execution. Now it expects a Jacoco dump file in order to provide coverage data to sonar.

I cannot find any useful documentation in Sonarqube confluence.

How can we configure Sonar to use Cobertura (without modifying ALL the projects pom files) and trigger code coverage unit test execution from Jenkins?.

Thanks!.


Solution

  • Since version 2.2 of Java Plugin and 1.6 of Cobertura plugin, SonarQube does not trigger unit test execution anymore : Only reuse report mode is available.

    Please note that the recommended version for both of those plugins are the fixed versions Java 2.2.1 and Cobertura 1.6.1 to prevent the collision between JaCoCo and Cobertura plugin (which will happen with 2.2).

    Because of all this, the property to select the default code coverage tool is not relevant anymore and you only have to provide a coverage report (either cobertura or JaCoCo) to get your coverage information.

    Please refer to these piece of documentation to get a rough idea on how to do so : http://docs.codehaus.org/display/SONAR/Cobertura+Plugin http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin