We are using SonarQube 9.7.1.
We run SonarQube on our CI server. Lately, we’ve been running our tools in the build inside an image, including the “sonar:sonar” goal from mvn. It turns out that that’s been running in a way that “user.home” ends up being deduced as “?”, because the running user isn’t in a passwd file. As a result, it’s been saying:
User cache: ?/.sonar/cache
I’m not sure what that does, but it doesn’t cause any obvious harm. If it’s simply not caching anything, that probably isn’t going to give great performance, but at least it works.
I’m now testing a change that results in “user.home” being set to “/” because I’m mapping the ~/.m2 directory on the host to “/.m2”. This makes my maven cache fast, but now SonarQube fails with
Unable to create user cache: /.sonar/cache
I believe I can change my docker mapping so that I not only map the “~/.m2” directory into the container, but also “~/.sonar”, although I’m not certain it will exist, so I guess I’ll have to manually create it empty on the host if it doesn’t exist before the scan.
One thing I’m wondering, however, is whether the “~/.sonar/cache” directory intended to be shared between multiple processes. I would think it would be, but I’d better be sure.