Analysing a C++ project, using bazel : "build-wrapper-dump.json" file was found empty

Following this post, I have learnt that

the docs on cfamily seem outdated(?)

as the --batch command is deprecated and Bazel complains when I use --spawn_strategy=local --genrule_strategy=local --bazelrc=/dev/null

Following the solution on the very post, I have run

bazel clean
build-wrapper-linux-x86-64 --out-dir <build-wrapper-output-directory> bazel --batch build --spawn_strategy=standalone --genrule_strategy=standalone <targets> <important-flags>
sonar-scanner

and my scan execution is successful!
Thank you