【问题标题】:How to update project using gradle automatically when executing sonar-runner?执行 sonar-runner 时如何使用 gradle 自动更新项目?
【发布时间】:2015-07-25 00:59:14
【问题描述】:

我正在使用:

  • Android Studio 1.2
  • SonarQube 5.1

...我想在通过SonarQube之前强制Android应用程序的项目构建,也许修改gradle配置文件。

我已将下一行添加到build.gradle 文件:

apply plugin: "sonar-runner"

sonarRunner {
    sonarProperties {
        property "sonar.host.url", "http://localhost:9000"
        property "sonar.analysis.mode", "incremental"
        property 'sonar.sourceEncoding', 'UTF-8'
        property 'sonar.language', 'java'
        property "sonar.sources", "src/main"
        property 'sonar.profile', 'Android Lint'
        property 'sonar.import_unknown_files', 'true'
    }
}

subprojects {
    sonarRunner {
        sonarProperties {
            property "sonar.sources", "src/main"
        }
    }
}

为了达到预期的行为,我应该改变什么?

【问题讨论】:

  • 转到模块的builde.gradle,而不是应用程序
  • 拜托,你能解释一下吗,@Krupal?
  • 在 gradle 脚本部分,您会发现两个 build.gradle...转到第一个...您正在显示第二个
  • 好的@Krupal,但是......我应该在那个文件中添加什么?请问,你能回答这个问题吗?

标签: android sonarqube android-gradle-plugin lint sonar-runner


【解决方案1】:

只需在 module build.gradle 文件中添加一个新行,就在 sonarRunner 任务声明之后:

sonarRunner {
    tasks.sonarRunner.dependsOn build  // <- This new line
    sonarProperties {

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-12
    • 2014-10-08
    • 2017-09-25
    • 1970-01-01
    • 2015-03-03
    • 2018-05-29
    • 2015-12-21
    相关资源
    最近更新 更多