我想将 Sonar 配置属性从 build.gradle 文件外部化到 gradle.properties 文件。
例如,
应用插件:'sonar-runner'
sonarRunner
Sonar 属性
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.host.url", "http://10.42.58.229:9000/"
property "sonar.jdbc.url", "jdbc:mysql://10.42.58.229:3306/sonar"
property "sonar.jdbc.driverClassName", "com.mysql.jdbc.Driver"
我想从用户主页中存在的 gradle.properties 文件传递属性值。
最佳答案
这是可能的,但诀窍是您必须使用系统属性(使用 systemProp 前缀):
systemProp.sonar.host.url=http://localhost:9000
systemProp.sonar.jdbc.url=jdbc:postgresql://localhost/sonar
systemProp.sonar.jdbc.username=sonar
systemProp.sonar.jdbc.password=sonar
systemProp.sonar.login=admin
systemProp.sonar.password=admin
看:
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle#AnalyzingwithSonarQubeScannerforGradle-Globalconfigurationsettings
这应该适用于旧的 'sonar-runner' 插件,但可以随意尝试新的 'org.sonarqube' 插件:
https://plugins.gradle.org/plugin/org.sonarqube
关于gradle - 将 Sonar 配置属性外部化到用户主页中的 gradle.properties 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30827333/