在sonar.properties文件中禁用SCM无效。

5
似乎在配置文件中添加sonar.scm.disabled=true无效。 sonar-scanner将报告以下错误:
ERROR:执行SonarQube Scanner时出错   java.lang.IllegalStateException:执行文件的责任时出错   betamao / betamao / admin.py 在   org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:86)     在   org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59)     在org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:86)时   org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)     在   org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)   ...
我仍然需要在“常规设置> SCM”管理页面中禁用SCM,才能使其正常工作。
这是一个错误吗?
我的环境是:
使用openjdk8-u131的sonar-scanner 3.0.3.778
使用openjdk8-u131的sonarqube-5.6.6lts

2
你为什么认为 disable=false 应该把任何东西“关闭”? - G. Ann - SonarSource Team
2
@G.Ann-SonarSourceTeam 非常抱歉我的编辑错误,应该是 sonar.scm.disabled=true,我已经在上面的问题中进行了更正。文档链接描述了: 可以在“常规设置> SCM”管理页面中禁用SCM支持,或在项目分析期间设置属性sonar.scm.disabled=true来实现。 所以我认为 disabel=true 可能与页面上的SCM设置具有相同的效果? - mangobowl
@mangobowl 这是一个单模块项目吗?你是在 sonar-project.properties 文件中定义了该属性吗? - Duarte Meneses
请提供有关您在哪里添加了 sonar.scm.disabled=true 的更多详细信息。目前还不清楚,我怀疑您很可能没有在正确的位置添加它,这就是为什么它没有生效的原因。 - janos
1个回答

6

如果你使用 Gradle 来构建你的项目,你可以使用属性 sonar.scm.disabled

例如,在你的 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"
    }
}

您也可以通过命令行将该属性传递给Gradle:

./gradlew sonarqube -Dsonar.scm.disabled=True

我正在Java_Opts(命令行参数)中添加它,作为-Dsonar.scm.disabled=True。应该是true还是True?哪个是正确的,或者两者都可以使用? - undefined
@SumukhBhandarkar:我无法确定地回答这个问题,因为我不再使用SonarQube了。我会像我在回答中那样使用大写的“True”。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接