Getting NoSuchFileException for build-wrapper-dump.json when attempting to scan C/C++ project

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

    1. sonarqube-developer-8.2.0.32929
    2. sonar-scanner-cli-4.2.0.1873-linux
    3. build-wrapper-linux-x86
  • what are you trying to achieve

    • I’m new to SonarQube and simply trying to successfully run solar-scanner of sample project “sonarqube-scanner-build-wrapper-linux”.

    • I think I’ve set things up correctly but I’m getting the error

Error during SonarQube Scanner execution
java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /home/anguyen/sonarqube-scanner-> build-wrapper-linux/bw-outputs/build-wrapper-dump.json

- I am running on a single Linux machine (CentOS 7)
  • what have you tried so far to achieve this

    • Here is my PATH variable:

$echo $PATH
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/home/anguyen/sonarqube/bin/linux-x86-64:/home/anguyen/.local/bin:/home/anguyen/bin:/home/anguyen/sonarqube/bin/linux-x86-64:/home/anguyen/sonarqube/sonar-scanner/bin:/home/anguyen/sonarqube/build-wrapper-linux-x86-64

- Here is my scanner command:

~/sonarqube-scanner-$sonar-scanner \

-Dsonar.projectKey=sonarqube-scanner-build-wrapper-linux
-Dsonar.sources=.
-Dsonar.host.url=http://localhost:9000
-Dsonar.login=58ad79c7ca6b27fc5ef951b64a660c121179381f -X > sonar-scanner.out

- Here is the error:

ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: java.nio.file.NoSuchFileException: /home/anguyen/sonarqube-scanner-build-wrapper-linux/bw-outputs/build-wrapper-dump.json

- Thank you very much in advance for your help.

Hi @anguyen,

what is the value of sonar.cfamily.build-wrapper-output? It should be set to the folder you are specifying on build-wrapper command line.

Hello Massimo,

Thank you for your quick reply.

The value of sonar.cfamily.build-wrapper-output is set = ./bw-outputs in sonar-project.properties, which is in the project root directory. The project root directory is ~/sonarqube-scanner-build-wrapper-linux

Before running sonar-scanner I made sure that directory bw-outputs exists:

~/sonarqube-scanner-build-wrapper-linux$lf
total 48
drwxrwxr-x. 2 anguyen anguyen 6 Apr 6 14:56 build
-rwxr-xr-x. 1 anguyen anguyen 318 Apr 6 14:56
build.sh
drwxrwxr-x. 2 anguyen anguyen 6 Apr 8 12:27 bw-outputs
-rw-rw-r–. 1 anguyen anguyen 602 Apr 6 14:56 makefile
-rw-rw-r–. 1 anguyen anguyen 729 Apr 6 14:56
README.md
-rw-rw-r–. 1 anguyen anguyen 290 Apr 6 14:56
sonar-project.properties
-rw-rw-r–. 1 anguyen anguyen 30651 Apr 8 12:31 sonar-scanner.out
drwxrwxr-x. 2 anguyen anguyen 73 Apr 6 14:56 src

I’m still getting the same error (Java NoSuchFileException).

I’m attaching the sonar-scanner output (stdout and stderr).

Thanks again,

Ai

This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.

(Attachment sonar-scanner.out is missing)

Resending with output file attachment (previous attachment was rejected by web site)

This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.

sonar-scanner.txt (29.9 KB)

Hi @anguyen,

is there any file in this folder? Are you launching build-wrapper before sonar-scanner?

Hello Massimo,

The problem is solved: I did not run build-wrapper before sonar-scanner. I did not understand this from the instructions.

Thank you very much for your help,

Ai

This email is intended solely for the recipient. It may contain privileged, proprietary or confidential information or material. If you are not the intended recipient, please delete this email and any attachments and notify the sender of the error.

1 Like

Hi @anguyen,

thank you for the update, glad you fixed the issue.

A post was split to a new topic: NoSuchFileException for build-wrapper-dump.json