【问题标题】:Connect SonarQube (4.5.4 ) with Gradle (2.1) throws HTTP 400将 SonarQube (4.5.4) 与 Gradle (2.1) 连接会引发 HTTP 400
【发布时间】:2015-09-20 01:28:13
【问题描述】:

我想将 Gradle(2.1 版)与 SonarQube(4.5.4 LTS)连接,但是有这个异常

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':<myProject>:sonarAnalyze'.
> java.io.IOException: Server returned HTTP response code: 400 for URL:  http://localhost:9000/batch/

* Try:
Run with --debug option to get more log output.

Post 相关的应该是可能的,here 可能是带有相关解决方法的 Bug。

但是我该如何使用它呢?将 zip 解压缩到项目中并从 zip 文件中导入 build.gradle 中的行对我不起作用:((没有区别)。

build.gradle 中的声纳配置:

apply plugin: "sonar"

sonar {
    server {
        url = "http://localhost:9000"
    }
    database {
        url = "jdbc:mysql://localhost:3306/sonar"
        driverClassName = "com.mysql.jdbc.Driver"
        username = "sonar"
        password = <myPassword>
    }
}

apply plugin: 'sonar-runner'

sonarRunner {
    sonarProperties {
        property 'sonar.host.url', 'http://localhost:9000'
    }
}

提前致谢:)

PS:Gradle 和 Sonarqube 工作正常。

【问题讨论】:

    标签: gradle sonarqube build.gradle sonarqube-4.5 gradle-2


    【解决方案1】:

    声纳插件是deprecated:

    您可能希望使用新的 Sonar Runner 插件而不是这个 插入。特别是,只有 Sonar Runner 插件支持 Sonar 3.4 及更高。

    仅使用Sonar Runner Plugin

    apply plugin: "sonar-runner"
    
    sonarRunner {
        sonarProperties {
            property "sonar.host.url", "http://localhost:9000"
            property "sonar.jdbc.url", "jdbc:mysql://localhost:3306/sonar"
            property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
            property "sonar.jdbc.username", "sonar"
            property "sonar.jdbc.password", "<myPassword>"
        }
    }
    

    【讨论】:

      【解决方案2】:

      事实上,Gradle 发行版中的两个 SonarQube 插件现在已被弃用。请参阅 Gradle 团队的以下官方消息:https://twitter.com/gradle/status/613530568655966208。只能使用由 SonarSource 团队直接维护的新版本:http://docs.sonarqube.org/display/SONAR/Analyzing+with+Gradle

      【讨论】:

        猜你喜欢
        • 2016-06-05
        • 1970-01-01
        • 2020-08-29
        • 2016-10-16
        • 2015-07-06
        • 2015-05-08
        • 2017-04-19
        • 1970-01-01
        • 2017-05-23
        相关资源
        最近更新 更多