Versions
SonarQube: Community Edition Version 10.3 (build 82913)
Scanner: sonar-scanner-npm 4.2.2
OS: Windows 11
Context:
I have a mono repo using nx; commands are run from the repo root, with working directories set for each sub-project. Each sub-project defines a sonar-project.properties
that specifies the project key and project base directory (to limit source input files). Scanner runs use npx to run the most recent scanner release.
Issue
Up until 3.5.0, the projectBaseDir
was processed from the properties file and applied. Since 4.0.0 was released, this setting is no longer applied and the default value for projectBaseDir
is used. All releases from 4.0.0 to 4.2.2 have the issue.
Workaround:
Pin the sonar scanner version to 3.5.0.
Examples
Assume repo root is C:\Users\<***>\repo
and sonar-project.properties
contains
sonar.projectBaseDir=sub-project-1
Working
npx sonarqube-scanner@3.5.0 -Dproject.settings=sub-project-1/sonar-project.properties
Results in the following logs:
INFO: Base dir: C:\Users\<***>\repo\sub-project-1
Not working
npx sonarqube-scanner@4.2.2 -Dproject.settings=sub-project-1/sonar-project.properties
Results in the following logs:
INFO: Base dir: C:\Users\<***>\repo