Issue
In your build you are generating tests coverage data using jacoco and the import of these data in SonarQube is failing with an error like :
15:49:32 [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXX: Unable to read /scratch/jenkins/workspace/xxxx/xxxx/target/jacoco.exec: Incompatible version 1007. -> [Help 1] 15:49:32 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project XXXX: Unable to read /scratch/jenkins/workspace/xxxx/xxxx/target/jacoco.exec 15:49:32 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 15:49:32 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 15:49:32 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 15:49:32 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 15:49:32 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 15:49:32 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 15:49:32 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 15:49:32 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 15:49:32 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 15:49:32 at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 15:49:32 at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 15:49:32 at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 15:49:32 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 15:49:32 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 15:49:32 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 15:49:32 at java.lang.reflect.Method.invoke(Method.java:497) 15:49:32 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 15:49:32 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 15:49:32 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 15:49:32 at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 15:49:32 Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to read /scratch/jenkins/workspace/master-sonar/atos-adapter/target/jacoco.exec 15:49:32 at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41) 15:49:32 at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:139) 15:49:32 at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:132) 15:49:32 at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 15:49:32 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 15:49:32 ... 19 more 15:49:32 Caused by: org.sonar.api.utils.SonarException: Unable to read /scratch/jenkins/workspace/master-sonar/atos-adapter/target/jacoco.exec 15:49:32 at org.sonar.plugins.jacoco.JaCoCoOverallSensor.loadSourceFiles(JaCoCoOverallSensor.java:123) 15:49:32 at org.sonar.plugins.jacoco.JaCoCoOverallSensor.mergeReports(JaCoCoOverallSensor.java:96) 15:49:32 at org.sonar.plugins.jacoco.JaCoCoOverallSensor.analyse(JaCoCoOverallSensor.java:87) 15:49:32 at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79) 15:49:32 at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70) 15:49:32 at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:131) 15:49:32 at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178) 15:49:32 at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 15:49:32 at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) 15:49:32 at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199) 15:49:32 at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194) 15:49:32 at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:192) 15:49:32 at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187) 15:49:32 at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 15:49:32 at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) 15:49:32 at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56) 15:49:32 at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44) 15:49:32 at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82) 15:49:32 at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 15:49:32 at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) 15:49:32 at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175) 15:49:32 at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163) 15:49:32 at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92) 15:49:32 at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77) 15:49:32 at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92) 15:49:32 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74) 15:49:32 at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48) 15:49:32 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 15:49:32 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 15:49:32 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 15:49:32 at java.lang.reflect.Method.invoke(Method.java:497) 15:49:32 at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87) 15:49:32 at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75) 15:49:32 at java.security.AccessController.doPrivileged(Native Method) 15:49:32 at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69) 15:49:32 at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50) 15:49:32 at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102) 15:49:32 at org.sonar.runner.api.Runner.execute(Runner.java:100) 15:49:32 at org.codehaus.mojo.sonar.bootstrap.RunnerBootstraper.execute(RunnerBootstraper.java:135) 15:49:32 ... 22 more 15:49:32 Caused by: java.io.IOException: Incompatible version 1007. 15:49:32 at org.jacoco.core.data.ExecutionDataReader.readHeader(ExecutionDataReader.java:127) 15:49:32 at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:107) 15:49:32 at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:87) 15:49:32 at org.sonar.plugins.jacoco.JaCoCoOverallSensor.loadSourceFiles(JaCoCoOverallSensor.java:121) 15:49:32 ... 60 more
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees Jenkins Enterprise - Managed controller
-
SonarQube
Solution
This problems comes from an incompatibility in jacoco data produced by your build in version 0.7.5 that SonarQube cannot read with Jacoco 0.7.4. More details:
To fix the issue you need to generate your coverage data with Jacoco 0.7.4.
If you are using Apache Maven to produce them replace
org.jacoco:jacoco-maven-plugin:prepare-agent
``by
org.jacoco:jacoco-maven-plugin:0.7.4.201502262128:prepare-agent