使用 gradle sonarqube 插件执行错误
Execution error using gradle sonarqube plugin
由于某种原因,SonarQube 执行失败。但我不明白为什么。
分析之前运行良好,但突然间每次都会发生此错误(自运行以来唯一发生变化的是正在分析的代码)
服务器:
- SonarQube 4.5.4(在这种情况下应该无关紧要)
- PMD 插件 2.3
客户:
- Gradle 2.x(试过 2.2、2.4、2.6)
- 多模块项目(android)
- org.sonarqube.gradle:gradle-sonarqube-plugin:1.0
- 客户端 OS(TeamCity 构建代理):Linux,版本 3.13.0-52-generic
客户端错误日志(部分):
[16:05:28][Step 3/3] 14:04:06.125 INFO - Execute PMD 5.2.1 done: 2731 ms
[16:05:28][Step 3/3] :sonarqube FAILED
[16:05:28][Step 3/3] :sonarqube (Thread[Daemon worker,5,main]) completed. Took 28.276 secs.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] FAILURE: Build failed with an exception.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * What went wrong:
[16:05:28][Step 3/3] Execution failed for task ':sonarqube'.
[16:05:28][Step 3/3] > Unable to execute Sonar
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * Try:
[16:05:28][Step 3/3] Run with --debug option to get more log output.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * Exception is:
[16:05:28][Step 3/3] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
...
[16:05:28][Step 3/3] Caused by: java.lang.ClassNotFoundException: android.app.Service
[16:05:28][Step 3/3] ... 154 more
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] Stopped 0 compiler daemon(s).
[16:05:29][Step 3/3] Received result DaemonCommandResult[type=CommandFailure, value=org.gradle.launcher.exec.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':sonarqube'.] from daemon DaemonInfo{pid=23443, address=[ec2724a7-72a9-4431-9625-d454f3bd053c port:47788, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=87652ca6-5d94-436f-b633-630f97c81e4c,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/home/buildagent/.gradle/daemon,pid=23443,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]}.
[16:05:29][Step 3/3] Process exited with code 1
[16:05:29][Step 3/3] Step Sonar Report (Command Line) failed
将 SonarQube 中的 PMD 插件从版本 2.3 更新到 2.4.1 解决了我的问题。
由于某种原因,SonarQube 执行失败。但我不明白为什么。 分析之前运行良好,但突然间每次都会发生此错误(自运行以来唯一发生变化的是正在分析的代码)
服务器:
- SonarQube 4.5.4(在这种情况下应该无关紧要)
- PMD 插件 2.3
客户:
- Gradle 2.x(试过 2.2、2.4、2.6)
- 多模块项目(android)
- org.sonarqube.gradle:gradle-sonarqube-plugin:1.0
- 客户端 OS(TeamCity 构建代理):Linux,版本 3.13.0-52-generic
客户端错误日志(部分):
[16:05:28][Step 3/3] 14:04:06.125 INFO - Execute PMD 5.2.1 done: 2731 ms
[16:05:28][Step 3/3] :sonarqube FAILED
[16:05:28][Step 3/3] :sonarqube (Thread[Daemon worker,5,main]) completed. Took 28.276 secs.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] FAILURE: Build failed with an exception.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * What went wrong:
[16:05:28][Step 3/3] Execution failed for task ':sonarqube'.
[16:05:28][Step 3/3] > Unable to execute Sonar
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * Try:
[16:05:28][Step 3/3] Run with --debug option to get more log output.
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] * Exception is:
[16:05:28][Step 3/3] org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':sonarqube'.
...
[16:05:28][Step 3/3] Caused by: java.lang.ClassNotFoundException: android.app.Service
[16:05:28][Step 3/3] ... 154 more
[16:05:28][Step 3/3]
[16:05:28][Step 3/3] Stopped 0 compiler daemon(s).
[16:05:29][Step 3/3] Received result DaemonCommandResult[type=CommandFailure, value=org.gradle.launcher.exec.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':sonarqube'.] from daemon DaemonInfo{pid=23443, address=[ec2724a7-72a9-4431-9625-d454f3bd053c port:47788, addresses:[/0:0:0:0:0:0:0:1%lo, /127.0.0.1]], idle=false, context=DefaultDaemonContext[uid=87652ca6-5d94-436f-b633-630f97c81e4c,javaHome=/usr/lib/jvm/java-8-oracle,daemonRegistryDir=/home/buildagent/.gradle/daemon,pid=23443,idleTimeout=120000,daemonOpts=-XX:MaxPermSize=512m,-Dfile.encoding=US-ASCII,-Duser.country=US,-Duser.language=en,-Duser.variant]}.
[16:05:29][Step 3/3] Process exited with code 1
[16:05:29][Step 3/3] Step Sonar Report (Command Line) failed
将 SonarQube 中的 PMD 插件从版本 2.3 更新到 2.4.1 解决了我的问题。