Goal: Getting the SCM plugin for Git to work with SonarQube 8.3.1
what have you tried so far to achieve this
I’ve got a warning in SonarQube which stated:
“SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.”
The git plugin is installed on the SonarQube server.
In TeamCity:
[12:31:42] [Step 5/5] WARN: SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.
How do I set the property? It will always be git for all of our projects.
It is weird that the autodetection doesn’t work though.
If auto detection isn’t working it’s because analysis isn’t seeing the .git files in the project directory. Are you analyzing from the checkout directory or a sub-directory?
If the latter, I think you need to kick analysis off from the parent directory - the one with the .git folder - and just update the analysis parameters accordingly.
Okay, figured out why I have a problem after following your suggestions.
I looked at the work folder for the project, the .git folder does not exist.
There’s a .sonarqube folder but no .git.
So no wonder there’s a problem.
Since I’m checking out the code on the build server itself and sending it to the build agent (got a proxy thing going on and the build agent cannot access the repo itself …), there’s no .git folder.
The TeamCity server does not forward the .git folder to the build agent. Doesn’t seem like there’s a way to remedy it. But at least now I know why there’s an issue.