Sonar Maven plugin cache cleanup

scanner

(Michele Lorenzini) #1

We have setup Sonar scanner with Maven and we see the plugin creates some cache files under ~/.sonar/cache.
The cache files are deleted and re-created at every build but they are not cleaned up at the end of build.
At the moment we see a cache of almost 100Mb which has to be multiplied by the number of users which does the builds, so its not an irrelevant amount of space (we ended to till up the home filesystem after some more users started up to use Sonar in the builds).

As I can see, the only way to put cache files in another place is to override user.home settings, but this will apply to all Maven settings and not only to Sonar plugin.

So:

  • why are the cache files not cleaned up at the end of any build, if they are deleted at every build startup?
  • if it’s not possible, I would have some specific settings to be able to locate the cache files in a place/filesystem other than the user home.

Thanks,
regards


(Duarte Meneses) #3

Hi,
The cache under ~/.sonar contains mainly the analyzers downloaded during the SonarQube analysis. These never get deleted, so if you upgrade analyzers in your SonarQube instance or connect to a different SonarQube instance that has different analyzers, you will start having more and more analyzers in your cache.

You can define the location of the home used by the scanner in 2 other ways which are specific to the SonarQube scanner:

  • Define sonar.userHome (with -D in maven)
  • Set in the environment SONAR_USER_HOME