5

It seems that adding sonar.scm.disabled=true to the conf doesn't not work. The sonar-scanner will report the following error:

ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: Error when executing blame for file betamao/betamao/admin.py at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:86) at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59) at org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:86) at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) ...

I still have to disable SCM in "General Settings > SCM" administration page to make it work.

Is this a bug?

My environment is:

sonar-scanner 3.0.3.778 with openjdk8-u131

sonarqube-5.6.6lts with openjdk8-u131

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
mangobowl
  • 81
  • 1
  • 1
  • 6
  • 2
    Why would you think `disable=false` should turn anything _off_? – G. Ann - SonarSource Team May 19 '17 at 11:49
  • 2
    @G.Ann-SonarSourceTeam I'm sorry for my editing mistake, It should be `sonar.scm.disabled=true`, and I correct it in my question above. the dosc [link](https://docs.sonarqube.org/display/SONAR/SCM+support) discribed that `It is possible to disable SCM support in the "General Settings > SCM" administration page or setting property sonar.scm.disabled=true during project analysis.`. so i think `disabel=true` maybe the same effect as SCM settings on page? – mangobowl May 22 '17 at 01:56
  • @mangobowl is it a single module project? You defined the property in the file sonar-project.properties? – Duarte Meneses May 22 '17 at 11:27
  • Please provide more details about where exactly you added `sonar.scm.disabled=true`. As it stands, it's not clear, and I suspect you most probably added it not at the right place, that's why it's not taking effect. – janos May 22 '17 at 12:04

1 Answers1

6

If you're building your project with Gradle, you can use the property sonar.scm.disabled.

For example, set it in your build.gradle:

// Let SonarQube analyze the project
sonarqube {
    properties {
        property "sonar.projectKey", "YourProjectId"

        property "sonar.projectName", "Your Project"

        property "sonar.sourceEncoding", "UTF-8"

        // For SVN projects, SonarQube would run "svn blame" to know
        // who changed which parts of the code. Without authorization
        // this fails, so we disable it
        property "sonar.scm.disabled", "True"

        // Address of the SonarQube server
        property "sonar.host.url", "localhost:9000"
    }
}

You can also pass the property via the command line to Gradle:

./gradlew sonarqube -Dsonar.scm.disabled=True
Matthias Braun
  • 32,039
  • 22
  • 142
  • 171