Sonar and Gradle integration

Source: Internet
Author: User

Add the following configuration in Build.gradle

    1. Legacy Plugins
      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"
      }
      }

Command: gradle Clean build Sonaranalyze
Possible errors:

  • 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

  • New plugins
    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"

    }
    }

    Command: gradle Clean build Sonarrunner
    Possible error:

      • 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 and Gradle integration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.