-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for the new Sonar Gradle runner plugin #100
Comments
I will attempt to see if this can still be integrated. I did not have luck when I read the new plugin information. But I did not spend too much time. If I can perform the setup I will write a new page for the settings necessary. |
I spent some time researching what this issue is all about. Here is what I have found so far. The clover plugin for SonarQube is not up-to-date for the latest API. Using this plugin in SonarQube enables pushing Clover reports and parsing the information so SonarQube can display and use it. The new SonarQube Gradle plugin probably supports the same property configuration that is needed to produce results but without the clover plugin for SonarQube this goes nowhere. I am tempted to fix the issues that prevent that stale clover plugin for SonarQube and make a pull request but that is more that I have time for. If I get around to it then I will prove this still works and make some instructions available here. |
I'm using the sonar clover plugin successfully with SonarQube 7. After enabling the plugin on the server, I did the following. In gradle.properties: systemProp.sonar.host.url=http://my-sonar.com
systemProp.sonar.host.login=<key created by sonar>
systemProp.sonar.clover.reportPath=build/reports/clover/clover.xml In build.gradle: apply plugin: 'com.bmuschko.clover'
apply plugin: 'org.sonarqube'
clover {
targetPercentage = '90%'
excludes = [
'**/ExcludedClass.java',
'**/excludedpackage/*.*',
]
// set property that will be read by sonar plugin to match coverage exclusions
project.ext.'sonar.coverage.exclusions' = excludes.join(',')
report {
html = true
xml = true
}
}
sonarqube {
properties {
// read coverage exclusions set by clover
property "sonar.coverage.exclusions", project.ext.'sonar.coverage.exclusions'
}
}
build.finalizedBy cloverGenerateReport A few notes on the above:
With this configuration, when I run my build with So without any integration, these two plugins are working together. However, it would be awesome to have this plugin set the |
Thank you @mmindenhall for this information. I can see about having something akin to what you specified added to this plugin. It would be relatively easy for the plugin to react to the presence of the "org.sonarqube" plugin and add the extra properties. At a minimum I may add a paragraph in the README.md file documenting your experience with this integration. |
I looked into ways to integrate the two plugins, and concluded that either the sonar-scanner-gradle plugin would need to expose a way to set a property from within another plugin's code (doesn't seem possible the way the plugin is implemented), or this plugin would need to add a way to retrieve properties from other plugins. I then posted in the SonarQube Google group, and received this response:
For consistency, it sounds like the best approach would be to expose the relevant properties within this plugin, and read them from the sonar-scanner-gradle plugin. |
You can read the clover Closure parameters just as much as set them. You already do that. The same could be done in the Sonar plugin. The Illustration using your example.
FYI, the clover extension has been part of this plugin since the beginning and the excludes part has not changed much at all. |
Hi, since the actual valid plugin to send configuration to SonarQube is this one : https://plugins.gradle.org/plugin/org.sonarqube
The actual documentation is outdated.
I tried to follow the instructions and some workarounds and no one had success.
I'm using the:
classpath 'com.bmuschko:gradle-clover-plugin:2.1.2'
id "org.sonarqube" version "2.5"
SonarQube 5.6 LTS
The text was updated successfully, but these errors were encountered: