我们最近将gradle升级到了2.13版(在撰写本文时,最新版本)。我们正在使用sonarqube插件通过“gradlew clean test sonarqube”调用它。升级之前,Sonar一切正常。

升级到2.13版后,出现以下错误“不兼容的版本1007”,它似乎与gradle jacoco插件不兼容。我们目前正在使用2.0.1版本的sonarqube插件,我们也尝试了sonarRunner插件,该插件失败并出现相同的错误。还有其他人遇到这个问题,您如何解决?

plugins {
  id "org.sonarqube" version "2.0.1"
}


4:06:55.845 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task ':sonarqube'.
14:06:55.845 [ERROR] [org.gradle.BuildExceptionReporter] > Unable to read /var/lib/jenkins/jobs/Indicee-BI-API-Java-Library_platform_team/workspace/build/jacoco/test.exec
14:06:55.845 [ERROR] [org.gradle.BuildExceptionReporter]
14:06:55.846 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
14:06:55.846 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.

14:06:55.852 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Incompatible version 1007.
14:06:55.852 [ERROR] [org.gradle.BuildExceptionReporter]    at org.jacoco.core.data.ExecutionDataReader.readHeader(ExecutionDataReader.java:127)
14:06:55.852 [ERROR] [org.gradle.BuildExceptionReporter]    at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:107)
14:06:55.852 [ERROR] [org.gradle.BuildExceptionReporter]    at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:87)
14:06:55.853 [ERROR] [org.gradle.BuildExceptionReporter]    at org.sonar.plugins.jacoco.JaCoCoOverallSensor.loadSourceFiles(JaCoCoOverallSensor.java:124)
14:06:55.853 [ERROR] [org.gradle.BuildExceptionReporter]    ... 95 more

最佳答案

将Java的Sonar插件升级到3.13.1可以正常工作。谢谢。

07-24 09:46
查看更多