Gradle - 任务'sonarAnalyze'执行失败 - java.lang.ClassCastException:java.util.ArrayList无法强制转换为java.lang.String

时间:2012-07-06 19:58:42

标签: build gradle sonarqube

使用我的gradle构建脚本运行声纳时出现此错误。

gradle sonarAnalyze

15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an   exception.
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter]
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:41:02.931 [ERROR] [org.gradle.BuildExceptionReporter] Execution failed for task  ':sonarAnalyze'.
15:41:02.934 [ERROR] [org.gradle.BuildExceptionReporter] > java.util.ArrayList cannot be cast to java.lang.String



 My sonar 

sonar {
        server { 
        url = "http://server.com:9000"
        }
        database {

            url="jdbc:mysql://server:3306/sonar?useUnicode=true&characterEncoding=utf8"
            driverClassName="com.mysql.jdbc.Driver"
            username="sonar"
            password="sonar"
                }
                project {
                    coberturaReportPath=file("$buildDir/reports/cobertura/coverage.xml")
                    language = "java"
                }

            }

可能是什么问题?

1 个答案:

答案 0 :(得分:2)

你在运行什么版本的声纳?我在运行Sonar 4.1.1时遇到了这个问题,因为我使用的是同一个Gradle Sonar plugin。我切换到Gradle Sonar Runner plugin,问题解决了。