I would like to understand, if it's better to use the sonar-scanner
, or your build tool's plugin for this? For example, both Maven and Gradle have plugins for Sonar. From what I understand, the sonar-scanner
is an alternative to using it through your build tool. How does this help? Which approach is better? Does sonar-scanner
only publish to Sonarqube, or is it also responsible for other things like collecting/merging metrics and reports? Are there any articles that clarify these differences?
Using of sonar-scanner is suggested when You are using a build tool that does not have a specific sonar-scanner plugin. If You are using maven You should use the maven sonar scanner. Also some CI servers has sonar plugins which can be used to centralize SonarQube server connection configurations. (but a Sonar scanner has to be used this way and You should use Your build tools plugin in this case also.)
Sonarscanner is responsible for analyzing the code and sending the result of the analysis to SonarQube server. And SonarQube will do a final processing on these results. (keeping history of the analysis and metrics are server's responsibility.)
You can find the details in the following links.
https://docs.sonarqube.org/display/SCAN
https://docs.sonarqube.org/latest/analysis/background-tasks/
https://docs.sonarqube.org/latest/analysis/overview/
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