Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube upgrade from 6.4 to 6.5 breaks the scanner

  1. I am on sonarQube6.4 and have upgraded to 6.5
  2. Sonar-scanner is 3.0.3
  3. Now after the upgrade the scanner fails anytime there is a java file in the source path. If I don't scan java files everything works just fine.
  4. However If I rollback an use 6.4 version, everything works fine, so is there any regression? This is the stack trace, when I run the scanner command with -X command. So is it a mandate in 6.5 to provided the location of all compiled classed, is there a way to ignore it.

04:56:21.218 DEBUG: Sensors : JavaSquidSensor -> SurefireSensor -> JaCoCoSensor -> SonarJavaXmlFileSensor -> Analyzer for "php.ini" files -> Zero Coverage Sensor -> CPD Block Indexer 04:56:21.218 INFO: Sensor JavaSquidSensor [java] 04:56:21.558 INFO: Configured Java source version (sonar.java.source): none 04:56:21.565 INFO: JavaClasspath initialization 04:56:21.570 INFO: ------------------------------------------------------------------------ 04:56:21.571 INFO: EXECUTION FAILURE 04:56:21.571 INFO: ------------------------------------------------------------------------ 04:56:21.571 INFO: Total time: 6.545s 04:56:21.707 INFO: Final Memory: 51M/1083M 04:56:21.707 INFO: ------------------------------------------------------------------------ 04:56:21.707 ERROR: Error during SonarQube Scanner execution org.sonar.squidbridge.api.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property at org.sonar.java.JavaClasspath.init(JavaClasspath.java:59) at org.sonar.java.AbstractJavaClasspath.getElements(AbstractJavaClasspath.java:281) at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:141) at org.sonar.java.JavaSquid.(JavaSquid.java:83) at org.sonar.plugins.java.JavaSquidSensor.execute(JavaSquidSensor.java:83) at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53) at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82) at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68) at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78) at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:179) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129) at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:261) at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:256) at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:245) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129) at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47) at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129) at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:119) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123) at org.sonarsource.scanner.cli.Main.execute(Main.java:77) at org.sonarsource.scanner.cli.Main.main(Main.java:61) 04:56:21.710 DEBUG: Execution getVersion 04:56:21.711 DEBUG: Execution stop

When I run the same with 6.4, it works fine and the only warning I see in the console is :

04:52:42.738 WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property

like image 964
Prashant Saddi Avatar asked Aug 20 '17 12:08

Prashant Saddi


People also ask

How do I change my version of SonarQube?

In SonarQube, click your project, then 'Activity' tab. On the left panel you will see all versions. Click little pencil icon next to your version to change it.

What is the difference between SonarQube and sonar scanner?

SonarScanner is a separate client type application that in connection with the SonarQube server will run project analysis and then send the results to the SonarQube server to process it. SonarScanner can handle most programming languages supported by SonarQube except C# and VB.

Is sonar scanner is the default scanner of SonarQube?

The SonarScanner is the scanner to use when there is no specific scanner for your build system.


1 Answers

Error during SonarQube Scanner execution org.sonar.squidbridge.api.AnalysisException: Please provide compiled classes of your project with sonar.java.binaries property

Since SonarJava 4.12, you must specify sonar.java.binaries property https://docs.sonarqube.org/display/PLUG/Java+Plugin+and+Bytecode

Example :

sonar-scanner -Dsonar.projectKey=fr.demo:my-project -Dsonar.sources=. -Dsonar.java.binaries=.
like image 174
gujou Avatar answered Oct 25 '22 20:10

gujou