SonarJava 6.1 upgrade results in a massive performance drop, coverage data gone

Environment:
SonarQube versions: 7.9.1.27448, 8.1.0.31237
SonarJava: 6.1
Jenkins: 2.219
Maven

After upgrading the SonarJava plugin from 5.14 to 6.1, Sonar scan went from 15min to 45-50 min.
Also coverage data disappeared
In maven logs I see:
[INFO] 20:28:17.254 Java Test Files AST scan (done) | time=5888ms
[INFO] 20:28:17.254 29/29 source files have been analyzed
[INFO] 20:28:17.255 Sensor JavaSquidSensor [java] (done) | time=161312ms
[INFO] 20:28:17.256 Sensor JaCoCo XML Report Importer [jacoco]
[DEBUG] 20:28:17.258 Reading report ‘C:\jenkins\workspace \ [project dir] \ [module dir]\target\site\jacoco-aggregate\jacoco.xml’

[INFO] 20:28:17.307 Sensor JaCoCo XML Report Importer [jacoco] (done) | time=51ms
[INFO] 20:28:17.307 Sensor SurefireSensor [java]
I updated maven arguments to use xmlreports instead of reports config field, e.g.:
mvn clean verify jacoco:report-aggregate sonar:sonar -am -e -X -P sonarqube,allTests -Dsonar.java.coveragePlugin=jacoco -Dsonar.dynamicAnalysis=reuseReports -Dsonar.language=java -Dsonar.coverage.jacoco.xmlReportPaths="target/site/jacoco-aggregate/jacoco.xml" -Dmaven.multiModuleProjectDirectory="C:\jenkins\workspace\XXXXX"

1 Like

The performance drop is a known problem:

2 Likes

@agabrys Thanks for the good news. What about the loss of coverage info? Any chance of addressing that issue?

Hi @sergek,
Could you try to check your maven configuration and command line using this guide: [Coverage & Test Data] Importing JaCoCo coverage report in XML format?
Then could you check the content of target/site/jacoco-aggregate/jacoco.xml to figure out if the xml file does not contain coverage information or if JaCoCo XML report importer is not able to import the coverage report.

@alban.auzeill I checked the .xml reports and saw module-specific content in them.
There were no errors in the logs.
The coverage simply stopped being shown in SQ. Jenkins still shows coverage though

1 Like

Hi @sergek,

When I said: Then could you check the content of target/site/jacoco-aggregate/jacoco.xml
I meant:

  • If I don’t see the coverage of the file module-1/src/main/java/pkg/Foo.java in SonarQube
  • I check the report used to import the coverage of module-1 (for example: module-1/target/site/jacoco-aggregate/jacoco.xml)
  • In the xml file, I look for some data about pkg/Foo where the covered attribute is not always equal to "0"

If jacoco.xml does not contains the coverage information that you are looking for, your problem could be related to this one: Jacoco XML format cannot work as good as the binary format for multi-module maven