SonarRunner fail error: ' Unknown database status: FRESH_INSTALL'


(Firas Fafi) #1

Hello, I have problem with using Sonar-runner pluging. I have configured the sonar-runner task like this:

sonarRunner{
  sonarProperties {
    property 'sonar.sources',sourceSets.myproject.java.srcDirs
    property 'sonar.tests' ,sourceSets.unitTest.java.srcDirs
    property 'sonar.host.url', 'http://ci.myproject.com:9000'
    property 'sonar.jdbc.url', 'jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8'
    property 'sonar.driverClassName','com.mysql.jdbc.Driver'
    property 'sonar.jdbc.username', 'sonar'
    property 'sonar.jdbc.password', 'sonar'
    property 'sonar.projectKey', 'com.myproject:MYPROJECT.Gradle'
    property 'sonar.projectName', 'MYPROJECT.Gradle'
    property 'sonar.projectVersion', '2014.04'
    property 'sonar.language', 'java'
    property 'sonar.binaries',sourceSets.myproject.runtimeClasspath+sourceSets.unitTest.runtimeClasspath
      property 'sonar.java.source','1.7'
    property 'sonar.sourceEncoding', 'UTF-8'
    property 'sonar.dynamicAnalysis','reuseReports'
    property 'sonar.java.coveragePlugin', 'jacoco'
    property 'sonar.jacoco.reportPath', "$buildDir/jacoco/jacoco.exec"
    property 'sonar.junit.reportsPath', "$buildDir/sonar-test-results"
  }
}

Using Mysql, I have created my database called ‘sonar’ and user ‘sonar’ that I grant all privileges. When I run sonnar-runner task I get this output:

....
:sonarRunner
14:09:29.745 INFO
- Load batch settings
14:09:29.841 INFO
- User cache: C:\Users\Firas\.sonar\cache
14:09:29.853 INFO
- Install plugins
14:09:29.982 INFO
- Install JDBC driver
14:09:29.990 INFO
- Create JDBC datasource for jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
:sonarRunner FAILED
  FAILURE: Build failed with an exception.
  * What went wrong:
Execution failed for task ':sonarRunner'.
> Unknown database status: FRESH_INSTALL

Thank you for your help!!


(Peter Niederwieser) #2

This issue doesn’t seem specific to Gradle. I recommend to ask on the Sonar mailing list.


(Firas Fafi) #3

True story, that’s look like an annoying problem in sonar-runner and database.

Thank you Peter