You’re looking at the docs for SonarCloud. I suggest making sure you look at the docs for your specific version of SonarQube. In v9.9 LTS, a compilation database isn’t generated by the build wrapper.
I’m experiencing a little confusion in this area too. We have a huge project where we run the build-wrapper and sonar-scanner in a daily CI job, with the wrapper downloaded from the SonarQube instance as part of the job to ensure that we always use the correct one. So far so good.
We want to enable the developers to use SonarLint in VSCode, but even when it is configured to use connected mode it seems that it wants a local compile_commands.json file. Shouldn’t it be able to pull that information from the server? The build system used by the developers’ day to day work is a bit of a clunky hodgepodge so it’s not a simple task to generate the file in their local workspaces.
I was hoping to get a cross-platform analysis running with the compilation database as it won’t work with the build wrapper. Abandoned that approach in the end as the scanner always probes the compiler first, I assume it would have been the same using the compilation database.
I have now successfully used the wrapper dump, analysis runs runs fine with that.