I run Sonar Cloud scanner manually and try to build the project, Project is build sucessfully using below command :-
build-wrapper-macosx-x86 --out-dir bw-output xcodebuild clean build -workspace Project.xcworkspace -scheme ProjectName
**** BUILD SUCCEEDED ****
But when i tried to run the scanner command it will gave me error :-
sonar-scanner
-Dsonar.organization=xyzdigital
-Dsonar.projectKey=xyzdigital_ios-app
-Dsonar.sources=.
-Dsonar.cfamily.compile-commands=bw-output/compile_commands.json
-Dsonar.host.url=https://sonarcloud.io
16:32:36.658 ERROR Error during SonarScanner Engine execution
java.lang.IllegalStateException: The Compilation Database JSON file was found empty. Please make sure to provide a non-empty file:
/Users/ABC/Documents/xyzdigital_ios-app/bw-output/compile_commands.json
at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:303)
at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:183)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:63)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:75)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:51)
at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:64)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:192)
at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:188)
at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:159)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.ScannerContainer.doAfterStart(ScannerContainer.java:416)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
at org.sonar.scanner.bootstrap.ScannerMain.runScannerEngine(ScannerMain.java:135)
at org.sonar.scanner.bootstrap.ScannerMain.run(ScannerMain.java:52)
at org.sonar.scanner.bootstrap.ScannerMain.main(ScannerMain.java:38)
16:32:37.142 INFO EXECUTION FAILURE
16:32:37.148 INFO Total time: 2:43.685s
MACOS Version :- 14.4 (23E214)
Xcode Version :- 15.1 (15C65)
Based on [CPP-4941] - Jira