"SCM provider autodetection failed." when using Maven


  • Zip install of SonarQube CE on to Windows Server
  • Analysis execution from KDE Neon (Ubuntu base) using Java 17 and Maven

I am trying to run analysis from my main project folder that does have a .git folder present.
If I do not supply -Dsonar.scm.provider=git, I always get this warning:
SCM provider autodetection failed. Both git and svn claim to support this project. Please use "sonar.scm.provider" to define SCM of your project.

After reading many similar reports, I can only conclude that .git is not being sent to the server or is being ignored for some reason; I been unable to find any documentation on how to ensure .git is included/respected.

Can someone please point me in the correct direction?

Could your repository also have a .svn folder sitting in there?

Nope, there is only the .git folder.

Is there any way to increase logging for the plugin so that I can see what is actually getting sent?

The server also complains about the lack of blame information, I presume this is related to it not having/processing the .git folder.

There’s not really much additional useful logging available on this topic.

It’s clear that the scanner can find the .git folder, otherwise the error message wouldn’t indicate that git has “claimed” to support the project.

I wonder if there’s an .svn folder erroneously sitting around in the directories above your project directory. Can you try a few cd ..; ls -a commands?

Let’s get through the git/svn dual claiming issue first. A lack of blame information can come from a few places:

  • Generated files during the build
  • Uncommitted files
  • A shallow clone (instead of a full clone)

.svn exists in some sibling locations, but not in the path to this specific project. As a test I copied the project over to /tmp and tried again. No issue this time. So, somehow, the plugin must be picking up on those .svn folders. Or there is an errant one floating around I have not found yet.

I have renamed all the .svn I can find and the plugin still reports the error in the original location. I just wish it would tell me where it’s finding the file. I can alway grab source and put in my own logging I guess.

Edit: I now have this project as a sibling with another, both under my home folder. The other works without error, but the current project (and many others, but not all) still fail.

Looking at the code (which I now realise is server-side), the only explanation is a some errant .svn but I simply cannot find any.

Found it! It was right in front of my face. ~/.svn. I rename/delete that, everything now works.

1 Like

Thanks. And just to confirm, this was in the base of your project? Or it was in the very root directory of your entire filesystem? Just trying to judge where the issue was and if something could be improved in the detection logic (if not a little more logging to flag which .svn folder is being picked up)

Also don’t hesitate to let us know if you still need help on this point:

As mentioned:

THanks for the help.

The random .svn was at the top-level of my home folder. The structure would have been someting like:

|- boot etc
|- home
|  |- me
|  |  |- .svn
|  |  |- work
|  |  |  |- folder
|  |  |  |  |- folder
|  |  |  |  |  |- project
|  |  |  |  |  |  |- .git
|  |  |  |  |  |  |- src
|  |  |  |  |  |  |- pom.xml etc
|  |  |  ...
|  ...

The blame information seems to now just restrictred to the pom.xml, it’s not something I am overly concerned about just now and I can revisit that in the future if it remains an issue.

1 Like