SonarQube on Java8-project gives jacoco-Exception

Here with java 11 I had this problem and I fix adding this in my gradle properties:

jacoco {
  toolVersion = "0.8.4"
}

I got the missing info from the SonarQube mailing-list... To summarize:

To get Java8 maven-build working on SonarQube-4.3:

  • Install sonarqube-4.3, and start the server.

  • Login to the web-gui => Settings => Update Center => Plugins Updates => Java => Click "Upgrade to 2.2.1"

Wait a minute or so for the upgrade to complete... then shutdown+restart sonarqube. Go back into the Upgrade Center and verify you have plugin: Java 2.2.1

  • To get code-coverage in Sonar, you now need to build with these commands:

    mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install 
    mvn sonar:sonar
    

Reference: http://docs.codehaus.org/display/SONAR/JaCoCo+Plugin

That's it.


I was getting the same error when mvn building a Java 1.7 project using JDK 1.8. The solution was simple: I changed the jacoco plugin version to a newer version:

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.7.6.201602180812</version>

(The project was using version 0.6.3.201306030806 before.)


If you are running jacoco with gradle them update the jacoco to latest version. I was also facing the similar issues and it got fixed after below changes

Java 11 and Gradle

jacoco {
    toolVersion = "0.8.4"
}