码迷,mamicode.com
首页 > 其他好文 > 详细

sonar和gradle集成

时间:2015-05-11 22:15:38      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

在build.gradle中添加如下配置

  1. 旧插件
    apply plugin: ‘sonar‘
    sonar {
    server {
                    url = "http://locahost:9000"
    
    }
    database {
    url=“jdbc:mysql://locahost:3306/sonar?useUnicode=true&characterEncoding=utf8”
    driverClassName=“com.mysql.jdbc.Driver”
    username=“sonar”
    password=“sonar”
    }
    }

命令: gradle clean build sonarAnalyze
可能的错误:

  • What went wrong:
    Execution failed for task ‘:sonarAnalyze‘.

    org.sonar.batch.bootstrapper.BootstrapException: Fail to download the file: http://locahost:9000/batch/sonar-batch-maven-compat-5.1.jar|3bf6a6eba33643805149fd9ad258744e

  • 新插件
    apply plugin: ‘sonar-runner‘
    sonarRunner {
    sonarProperties {

    property "sonar.language", "java"
    property "sonar.jdbc.url", "jdbc:mysql://locahost:3306/sonar?useUnicode=true&characterEncoding=utf8"
    property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
    property "sonar.jdbc.username", "sonar"
    property "sonar.jdbc.password", "sonar"
    property "sonar.language", "java"
    property "sonar.sources", "src"
    property "sonar.binaries", "build"
    
    // There is a problem when using "standard-project-layout:Sample Project" (by default)
    // because of the wide space
     property "sonar.projectKey", "jstinno:Mirror"
    

    }
    }

    命令: gradle clean build sonarRunner
    可能错误:

    • What went wrong:
      Execution failed for task ‘:sonarRunner‘.

      Could not resolve all dependencies for configuration ‘:sonarRunner‘.
      Could not find org.codehaus.sonar.runner:sonar-runner-dist:2.3.
      Searched in the following locations:
      file:/home/android/soft/android-sdk/extras/android/m2repository/org/codehaus/sonar/runner/sonar-runner-dist/2.3/sonar-runner-dist-2.3.pom

sonar和gradle集成

标签:

原文地址:http://my.oschina.net/hopeMan/blog/413433

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!