I want to Externalize the sonar configuration properties from build.gradle file to gradle.properties file.
for example, apply plugin: 'sonar-runner'
sonarRunner
sonarProperties
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"
I want to pass the property values from gradle.properties file, which is present in user home.
This is possible but the trick is that you have to use system properties (using systemProp prefix):
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
See: https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Gradle#AnalyzingwithSonarQubeScannerforGradle-Globalconfigurationsettings
This should work with the old 'sonar-runner' plugin but feel free to give a try to new 'org.sonarqube' plugin: https://plugins.gradle.org/plugin/org.sonarqube
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With