SonarQube TFS 2015 extenstion: Failed to delete temp folder

I just noticed in the TFS 2015 build log that the temp file created by SonarQube can’t be deleted off the build server? I’m not sure what account needs permissions to delete from that temp folder. (see log below)

Is the SonarQube temp directory location configurable?

INFO: ANALYSIS SUCCESSFUL, you can browse http://sonar:8999/dashboard/index/CSAT_CiTest
INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
INFO: More about the report processing at http://sonar:8999/api/ce/task?id=AWYv15eSsWWXFlPmyb7j
INFO: Task total time: 15.578 s
INFO: ------------------------------------------------------------------------
INFO: ------------------------------------------------------------------------
INFO: Total time: 25.391s
INFO: Final Memory: 65M/236M
INFO: ------------------------------------------------------------------------

ERROR: Failed to delete temp folder

java.nio.file.DirectoryNotEmptyException: C:\Users\TFSBuild_CSAT_SVCACC.sonar.sonartmp_2476308829446478892
at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source)
at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source)
at java.nio.file.Files.deleteIfExists(Unknown Source)
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(
at org.sonar.api.utils.internal.DefaultTempFolder$DeleteRecursivelyFileVisitor.postVisitDirectory(
at java.nio.file.Files.walkFileTree(Unknown Source)
at java.nio.file.Files.walkFileTree(Unknown Source)
at org.sonar.api.utils.internal.DefaultTempFolder.clean(
at org.sonar.api.utils.internal.DefaultTempFolder.stop(
at org.sonar.scanner.bootstrap.GlobalTempFolderProvider.stop(
at org.picocontainer.DefaultPicoContainer.stopAdapters(
at org.picocontainer.DefaultPicoContainer.stop(
at org.sonar.core.platform.ComponentContainer.stopComponents(
at org.sonar.batch.bootstrapper.Batch.doStop(
at org.sonar.batch.bootstrapper.Batch.stop(
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.stop(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(
at com.sun.proxy.$Proxy0.stop(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doStop(
at org.sonarsource.scanner.api.EmbeddedScanner.stop(
at org.sonarsource.scanner.cli.Main.execute(
at org.sonarsource.scanner.cli.Main.main(
The SonarQube Scanner has finished


1 Like


We also have this issue in our MSBuild builds.
It appears to be a timing issue, because it does not happen on every build (all run on the same machine).
Also we have only seen it happen on short-lived branches. But that is maybe due to the infrequent runs of the long-living branches.

We have:

  • Sonarqube: LTS 6.7.5
  • SonarC#: 7.7
  • Sonar MSBuild Scanner Net4.6: 4.4.2
  • Java on build machine: 1.8.191

The error output is the same as the one of above.

This error is bothering us because subsequent steps in our build.xml are skipped and our CI environment stops the build process after this failing task. We might be able to ignore this error, but thats not really convenient.