SonarQube no longer reporting test coverage from jacoco - sonarqube

SonarQube does no longer show test coverage for my project which is analyzed with jacoco. It seems there was an update on SonarQube (I found new rules dates May 19). I assume it also since then that the test coverage gathered with jacoco maven plugin is no longer evaluated. I've seen older questions with a similar issue, but that was 4 years ago:
JaCoCo SonarQube incompatible version 1007
I updated my POM to the latest plugin version 0.8.4 but to no avail. Any ideas where I need to change something so this works again?

I had exactly the same problem. The problem was that they deprecated the jacoco.exec file and now you have to use the XML format.
To use the new format you only have to install the official jacoco plugin in Sonarqube and everything it's going to work again without any more changes.

Related

SonarQube Configuration

We had recently implemented SonarQube in our team and we have a dashboard configured
We've been able to see some of the details but the line coverage and code coverage is 0 always
Can you advise what we're missing ? I've checked the configuration and all of it seems to be in place
Assuming the latest SonarQube version, note that, as mentioned in this thread
Version 5.12 of our SonarJava analyzer deprecated use JaCoCo’s binary format (.exec files) to import coverage.
As a replacement, we developed the sonar-jacoco plugin, which imports JaCoCo’s XML coverage report, and this is the preferred option now. I
That page illustrates how to include those reports for a maven or a gradle project. Again, it depends on the nature of your projects.

How do I get SonarQube to count spock/groovy unit tests?

I am trying to configure SonarQube to report an accurate count of the unit test cases in my repository, currently it is only showing the java jUnit test cases.
SonarQube reports the java jUnit test count as well as the overall coverage from jacoco which includes both java and groovy coverage.
How do I get SonarQube to recognize the groovy/spock unit tests in the overall count?
SonarQube 7.7 (I see the issue on 7.4 as well)
I am not sure if there is a specific sonar property I need to set in my Gradle configuration or if there is a plugin in SonarQube itself I need to install?
I do see some related answers about installing the Groovy plugin in SonarQube however there is no mention as to which version of SonarQube this is a solution for (I no longer see this plugin as available)
The marketplace had been missing the Groovy plugin for quite some time. A new version has just been released!
Simply installing the plugin that is available on the Marketplace solved this problem.
https://github.com/pmayweg/sonar-groovy

Does SonarQube 5.4's 'Sonar way' quality profile contain Findbugs?

There was saying that 'SonarQube Java Analyzer' will be containing FindBug rules .so we need not to add any external findbug rule to sonar .
http://www.sonarqube.org/sonarqube-java-analyzer-the-only-rule-engine-you-need/
Is this already added in SonarQube 5.4 ?
Thanks
Ganesh
What you should focus here is not the version of SonarQube but version of SonarQube Java Analyzer. Last release of the analyzer (3.12 at time of writing) contains rules that cover more than 80% of findbugs rules and this coverage is likely to keep increasing.
So yes, by updating to the latest version of SonarQube and the java analyzer, you don't need to use the FindBugs plugin anymore.
(Disclaimer, I am maintainer of the SonarQube java plugin, and author of the mentioned blog post in the question so I am a bit biaised here ;) )

How to exclude packages in sonar only for coverage but not for CheckStyle?

I want to exclude some packages only for Emma coverage from sonar report. I have tried like below -Dsonar.coverage.exclusions=ab/cyz/data/perftracking/dao/*
in Jenkins job configuration, It was not working for me. I am using sonar version 3.4.1, Emma Plug in version 1.3.
-Dsonar.exclusions=ab/cyz/data/perftracking/dao/* is working as expected but it is excluding packages from all sonar metrics.
Is there any way to exclude packages from Emma coverage.
Please help on this.
Thanks you:)
This is not the advice you were looking for, but that is a very old version of the platform, and Emma is deprecated - at least for Java. I suggest you start by upgrading your platform and switching to JaCoCo. Your exclusions should work then.

The Issues Report Plugin does not retrieve metrics

I have a problem when I run the Issues Report Plugin on the multi-module project. I noted that the documentation indicated that the plugin is incompatible with this kind of project.
Nevertheless, I tried to run a sonar-runner dry run on one of the modules using its projectKey and projectName (retrieved from the widget Description). Unfortunately, the plugin has not retrieved metrics previously analyzed for this module. All anomalies are marked as new.
Is there a way to ensure I get the right values?
The dry run mode for SonarQube analyses on multi-module projects suffers from limitations, which are all fixed in the upcoming 3.6.1 version of SonarQube.
See the following ticket: https://jira.codehaus.org/browse/SONAR-4265
And just to be clear: the Issues Report Plugin does not export measures of metrics, it only exports issues.

Resources