Failed to create temp file sonar 9.6

Hi,

I am trying to run sonar:sonar command, and I am getting this error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.8.0.2131:sonar (default-cli) on project bcp-ntlc-parent: Failed to create temp file: /project/data/target/sonar/.sonartmp/scanner-report5408140481941990192.zip

SonarQube instance: 9.6
sonar-maven-plugin: 3.8.0.2131
java: 11

I also tried with different OS to create a report, but the result was the same.

Any updates on this please ? I have the same problem

Nothing yet, apparently it is an issue with java maven projects with multimodules, when trying to create and clean the folder a temporary file for the parent pom.

In your case is it also a project with java maven multimodules?

Yes, it’s a project with java maven multimodules too.
We tried to launch it using a sonarqube instance with the sonar 9.3 version and it works. Maybe the solution is to downgrade but we haven’t already did it (it could cause other bugs). If you have the same problem, it could be a solution for you (for this project at least)

@Colin I saw you helped on a similar topic : Failed to create temp file

Have you got any workaround for this problem please ?

Hi @Jordan_Nicolich_Cast ,

Welcome to the community!

Can you provide the full analysis log and stacktrace, please?

 
Ann

Hi @ganncamp , we actually have the same problem. We wrote the details here : Failed to execute sonar-maven-plugin on project parent : Failed to create temp file
Thanks you

1 Like

Hello,
When we launches Sonar scanner for maven, we have an error :

[INFO] Reactor Summary for parent 1.1.0-SNAPSHOT:
[INFO]
[INFO] parent ............................................. FAILURE [ 55.282 s]
[INFO] apis ............................................... SUCCESS [  0.472 s]
[INFO] api-authorization-config-json ...................... SUCCESS [ 22.785 s]
[INFO] api-authorization-config ........................... SUCCESS [ 10.174 s]
[INFO] api-authorization-tree ............................. SUCCESS [ 15.778 s]
[INFO] api-authorization .................................. SUCCESS [  7.031 s]
[INFO] libraries .......................................... SUCCESS [  0.549 s]
[INFO] lib-authorization-config-json ...................... SUCCESS [ 25.724 s]
[INFO] lib-authorization-config ........................... SUCCESS [ 29.294 s]
[INFO] lib-authorization-tree ............................. SUCCESS [ 14.565 s]
[INFO] services ........................................... SUCCESS [  0.858 s]
[INFO] authorization ...................................... SUCCESS [ 20.376 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:28 min
[INFO] Finished at: 2023-01-16T10:06:23+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project parent: Failed to create temp file: /home/yanis/Documents/incepto/aiur-authorization/target/sonar/.sonartmp/scanner-report2119080169226243625.zip -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The command we launched :

mvn clean verify sonar:sonar -Dsonar.login= -Dsonar.projectKey=aiur-authorization -Dsonar.projectName=aiur-authorization -Dsonar.host.url= -Dsonar.qualitygate.wait=false -Dsonar.log.level=WARN -Dsonar.language=java -Dsonar.java.coveragePlugin=jacoco -Dsonar.jacoco.reportPath=$project.basedir/../target/jacoco.exec

We’re using SonarQube 9.5.0.56709.
Have you got any solution please ? We tried on other repos without any problem but on this one, it doesn’t works …

1 Like

We tried to launch it with a sonar 9.0 community and it works. So, we’re trying to find the last version we can use. It looks like an upgrade cause this …
Have you got any workaround to use one of the last versions please ?

It works with sonarqube docker community image 9.3 too, looks like the problem is on 9.4+ versions

Hi @Yanis_Corselle,

Thanks for pointing out your overlooked thread. I’ve combined it here (altho normally precedence would go to the older thread).

Can you add debug logging (-X I believe, for Maven) and provide the full analysis log? Also, is this replicable with the current version, SonarQube 9.8?

 
Ann

Hi @ganncamp ,
Thanks for your answer.
Yes, i tried with 9.8 version and we got the same problem.
Debug logging inside the file, thanks.
mvn-execution.log (109.0 KB)

1 Like

Hi,

Here’s the root error:

Caused by: java.nio.file.NoSuchFileException: /home/yanis/Documents/incepto/aiur-authorization/target/sonar/.sonartmp/scanner-report1126623369282812566.zip

Can you see what exists in that .sonartmp directory and what the directory permissions are?

 
Ann

The directory doesn’t exists, it looks like it’s created during the execution and deleted during it too. With a ls on sonar folder, i get :

yanis@debian-yanis:~/Documents/incepto/aiur-authorization$ ls -lAa target/sonar/
total 52
drwxr-xr-x  3 yanis yanis  4096 26 janv. 19:33 .
drwxr-xr-x 13 yanis yanis  4096 26 janv. 19:33 ..
drwxr-xr-x  2 yanis yanis 40960 26 janv. 19:34 scanner-report
-rw-r--r--  1 yanis yanis     0 26 janv. 19:33 .sonar_lock

Hi,

Okay thanks. I’ve flagged this for more expert eyes.

 
Ann

2 Likes

Thanks

Hi,
Would you be able to create a simple reproducer for the problem? As basic of a maven project as possible that triggers the error.

1 Like

Hello,
Thanks for your answer.
That’s the only repo on which we have this problem, i’ll try to find the difference with others but the structure is supposed to be the same (and i can’t share the repo because it’s confidential). If i find how to do a simple reproducer, i’ll share you it , thanks.
Or @Jordan_Nicolich_Cast , is your repo on which the problem happenned confidential ? Could you share it to sonar ?

1 Like

Hello, my repository is confidential, I am working on replicating the error

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:50 min
[INFO] Finished at: 2023-02-01T08:15:05-05:00
[INFO] Final Memory: 186M/1548M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project bcp-ntlc-parent: Failed to create temp file: /project/data/target/sonar/.sonartmp/scanner-report918138397002279506.zip -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project bcp-ntlc-parent: Failed to create temp file
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to create temp file
	at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(ScannerBootstrapper.java:67)
	at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:108)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
1 Like

Okay so, the first of us who’ll be able to replicate the problem sends it it here then :slight_smile:

3 Likes