Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use sonar-scanner over your build tool's plugin for Sonarqube?

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?

like image 306
carlspring Avatar asked Sep 13 '25 08:09

carlspring


1 Answers

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/

like image 58
miskender Avatar answered Sep 15 '25 23:09

miskender