Hi
We have a Java project on Gradle and use Docker for builds (we build project inside docker container). Recently we’ve updated Java from 8 to 12 and got the exception from “sonarqube” Gradle task.
The most interesting part of the exception:
Exception
Caused by: java.lang.IllegalStateException: Fail to create temp file in ?/.sonar/cache/_tmp
at org.sonarsource.scanner.api.internal.cache.FileCache.newTempFile(FileCache.java:138)
at org.sonarsource.scanner.api.internal.cache.FileCache.get(FileCache.java:83)
at org.sonarsource.scanner.api.internal.JarDownloader.lambda$getScannerEngineFiles$0(JarDownloader.java:60)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:61)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
... 186 more
Caused by: java.nio.file.NoSuchFileException: ?/.sonar/cache/_tmp/fileCache5903868184697272935.tmp
at org.sonarsource.scanner.api.internal.cache.FileCache.newTempFile(FileCache.java:136)
... 191 more
I’ve created an example project with the reproduce where I use exactly the same versions of Gradle, sonar plugin and java as we use in our project.
Steps to reproduce:
- Clone example project https://github.com/yevheniisemenov/sonar-gradle-in-docker-issue
- cd to project root directory
- in the project root directory run
docker run -u $(id -u ${USER}):$(id -g ${USER}) -ti -v $PWD:$PWD -w $PWD openjdk:12.0.1-jdk bash
- inside docker container run
./gradlew sonarqube -Dsonar.login=(paste your token here) -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=(paste your org name) -x test --stacktrace
If you do the same with “openjdk:8u181-jdk-slim” image everything works fine.
I’m not sure this is Sonar issue, but anyway I would be grateful for any help.