We want to use SonarQube with some CI tool in our project. Sonar Server url is configured in main pom.xml.
There are several team memebers in the project. So what happen when one team member executes sonar:sonar locally with his local changes, then another team member executes sonar:sonar with his local changes, and then someone executes sonar:sonar from CI tool (it is configured to analyse source code in Git repository)?
Will SonarQube display issues related team members local changes? What if there are differences between team members local source code and source code in Git repository?
sonar:sonar
executes analysis and sends the results to the server - assuming you're running it with the token of an account that has the appropriate privileges.
Developers should not be running this type of analysis locally to check their changes. Instead, they should be using SonarLint and perhaps pull request analysis (depending on your infrastructure).
(EDIT: Pull request analysis has been deprecated and replaced by a fuller-featured Branch analysis($).)
To expand a little on why developers shouldn't be using sonar:sonar
locally: it updates the central server in a last-saved-wins manner. So if you've edited A.java and analyzed it locally before commit, and I've renamed A.java to B.java and done a similar pre-commit local analysis... what's visible on the SonarQube server? Depends on who saved/analyzed last.
Instead, sonar:sonar
should be run only from your CI tool on the checked-in code that's already visible to the whole team.
As you said that sonar server url is cofigured in mail pom.xml and your team member's run sonar:sonar command at there local machine. But because of all referring to the same server url. So all changes will reflect for a common project. If you want to see then difference separately for each team member. then either you need to update the project name distinct from each other. Other wise you will see latest one there.
Sonar gives you difference in graphical manner. as well as you can compare two build too.
Second If user has administrator grant only then they can update sonar server else not.
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