Sonar-scanner failed to scan the source files if the source in different folder

Hi Sirs,
Below are the basic information of SonarQube server.
*SonarQube Developer Edition Version 9.6.1 (build 59531)
*SonarScanner 4.8.0.2856
*SonarQube is installed on Ubuntu 18.4 with Java Runtime
*Java 11.0.17 Eclipse Adoptium (64-bit)

  • Linux 5.4.0-150-generic amd64

I have built some test code and want to upload to Sonarqube server for static analysis.
When I perform the scan following the sequence of web page, sonar-scanner threw some warning message like that:

WARN: File '/share/New_Bare_Metal/BSP/A380/gcc.ld' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/a380.ld' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/start.S' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/startup_ARMCM4.s' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/startup.S' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/Include/spec_asm.h' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/Include/a380.h' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/Include/swi.h' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/BSP/A380/a380.c' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/YAML/a380.yaml' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.
WARN: File '/share/New_Bare_Metal/YAML/a380-old.yaml' is ignored. It is not located in project basedir '/share/New_Bare_Metal/generated_projects/make_gcc_arm_a380'.

The makefile which used for build-wrapper-linux-x86-64 is located in different folder with the source files. I have assigned the “-Dsonar.sources” to the source path, however,the result is the same.

Should we always put the source files under the same folder of makefile?
Is another way to resolve it?

Thanks.

Fred

Hi,

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

9.6.1 → 9.9 → 10.1 (last step optional)

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your error, all the code needs to be located in the sonar.projectBaseDir. By default that’s set to the directory from which analysis is triggered.

 
HTH,
Ann

Hi Ann,
Thanks for your comment.
I will upgrade SonarQube server later.
Before that, could we set the sonar.projectBaseDir in the project setting of webportal?
Thanks.

Hi Ann,
I have added the sonar-project.properties in the project folder to set the sonar.projectBaseDir to source file path,now the sonar.scanner is working.
Thanks for your support.

Fred