- Version: SonarQube Community Build v25.1.0.102122
- how is SonarQube deployed: Helm
Description:
We have updated our sonarqube version from 8.9 to 2025.1. We use sonar scanner in monorepository. Previously on version 8.9, our scans went through in 1-2 min. After the upgrade, our scans started taking 20 min to 40 min. We noticed in the logs that when trying to run a scan on one project, all projects in our monorep are analyzed.
Here is an example of our project launch parameters:
sonar.projectKey=app.studio-enterprise.shell
sonar.projectName=app.studio-enterprise.shell
sonar.sources=apps/studio-enterprise/shell/src
sonar.exclusions=**/node_modules/**
sonar.coverage.exclusions=**/*spec.ts, **/assets/*.js, **/environments/*.ts, **/*.conf.js, **/mocks/**, **/*.mock.ts,**/main.ts, **/index.ts, **/*.module.ts, **/*.stories.ts, **/polyfills.ts
sonar.tests=apps/studio-enterprise/shell/src/
sonar.test.inclusions=**/*.spec.ts
sonar.ts.tslint.configPath=apps/studio-enterprise/shell/tslint.json
sonar.typescript.lcov.reportPaths=apps/studio-enterprise/shell/coverage/lcov.info
sonar.analysis.mode=publish
sonar.eslint.reportPaths=apps/studio-enterprise/shell/report.json
What we trying to do?
We tried to add a parameter sonar.projectBaseDir, with the path to the project, in which case we needed to change all paths to relative paths, and our property file started to look like this:
sonar.projectKey=app.studio-enterprise.shell
sonar.projectName=app.studio-enterprise.shell
sonar.sources=src
sonar.projectBaseDir=apps/studio-enterprise/shell
sonar.exclusions=**/node_modules/**
sonar.coverage.exclusions=**/*spec.ts, **/assets/*.js, **/environments/*.ts, **/*.conf.js, **/mocks/**, **/*.mock.ts,**/main.ts, **/index.ts, **/*.module.ts, **/*.stories.ts, **/polyfills.ts
sonar.tests=src/
sonar.test.inclusions=**/*.spec.ts
sonar.ts.tslint.configPath=tslint.json
sonar.typescript.lcov.reportPaths=coverage/lcov.info
sonar.analysis.mode=publish
sonar.eslint.reportPaths=report.json
This helped to fix with the problem of analyzing the whole monorep, but after this change on coverage in projects became = 0. In the logs we see the message:
INFO: Analysing [/home/jenkins/agent/workspace/p.studio-enterprise.shell_master/apps/studio-enterprise/shell/coverage/lcov.info]
WARN: Could not resolve 41 file paths in [/home/jenkins/agent/workspace/p.studio-enterprise.shell_master/apps/studio-enterprise/shell/coverage/lcov.info]
WARN: First unresolved path: apps/studio-enterprise/shell/src/bootstrap.ts (Run in DEBUG mode to get full list of unresolved paths)
Please help fix the problem