Sonar Scanner java.lang.IllegalStateException Error

Hello,

We are getting errors when we try to scan swift and obj-c files. The error is like below. We think we are getting this error because we are trying to exclude Pods/**/* from scan. Some of the projects do not contains any objc files. We think this is the reason. How we can fix this issue? Is there any way to tell scanner that if there is no objc files, do not throw error, continue with success etc?.

java.lang.IllegalStateException: The “build-wrapper-dump.json” file was found but 0 C/C++/Objective-C files were analyzed. Please make sure that: 16:28:29 * you are using the latest version of the build-wrapper and the CFamily analyzer 16:28:29 * you are correctly invoking the scanner with correct configuration 16:28:29 * your compiler is supported 16:28:29 * you are wrapping your build correctly 16:28:29 * you are wrapping a full/clean build 16:28:29 * you are providing the path to the correct build-wrapper output directory 16:28:29 * you are building and analyzing the same source checkout, absolute paths must be identical in build and analysis steps 16:28:29 at com.sonar.cpp.plugin.CFamilySensor.process(CFamilySensor.java:494) 16:28:29 at com.sonar.cpp.plugin.CFamilySensor.execute(CFamilySensor.java:215) 16:28:29 at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64) 16:28:29 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88) 16:28:29 at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:64) 16:28:29 at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167) 16:28:29 at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403) 16:28:29 at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399) 16:28:29 at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167) 16:28:29 at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188) 16:28:29 at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167) 16:28:29 at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72) 16:28:29 at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66) 16:28:29 at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46) 16:28:29 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 16:28:29 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 16:28:29 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 16:28:29 at java.base/java.lang.reflect.Method.invoke(Method.java:566) 16:28:29 at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) 16:28:29 at com.sun.proxy.$Proxy0.execute(Unknown Source) 16:28:29 at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189) 16:28:29 at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138) 16:28:29 at org.sonarsource.scanner.cli.Main.execute(Main.java:126) 16:28:29 at org.sonarsource.scanner.cli.Main.execute(Main.java:81) 16:28:29 at org.sonarsource.scanner.cli.Main.main(Main.java:62) 16:28:30 [Pipeline] } 16:28:30 WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succeed?

Hey there.

As requested in the template post, what version of SonarQube are you using?

Hello Colin,

I guess I missed it. Currently LTS 9.9 is being used with sonar scanner version 6.41

Hey there.

If there aren’t objective-c files, there is no reason to use the build-wrapper. By not using the build wrapper, you won’t get an error that the build wrapper output was empty.

Hello,

Is there anyway to handle this from sonarscanner command line?

I suppose you can make sure you don’t provide the sonar.cfamily.build-wrapper-output analysis parameter to the sonar-scanner.

And still, running the build wrapper on a codebase with no C/C++/Objective-C files is not adding any value.