Search code examples
sonarqubestatic-analysissonarqube-scansonar-runnersonarqube5.1

ERROR: Error during SonarScanner execution


sonar properties fileI am trying to scan the source code of this website https://demo.testfire.net/ whose source code is https://github.com/HCL-TECH-SOFTWARE/AltoroJ/tree/master over here.

I don't understand how to do it. I followed some videos but this is the error I am getting. Can someone tell me the steps I need to follow, or point me to any video or blog that can be helpful to do so?

INFO: Scanner configuration file: C:\Users\vansi\Downloads\sonar-scanner-cli-4.6.2.2472-windows\sonar-scanner-4.6.2.2472-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\vansi\.sonar\cache
INFO: Scanner configuration file: C:\Users\vansi\Downloads\sonar-scanner-cli-4.6.2.2472-windows\sonar-scanner-4.6.2.2472-windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: Analyzing on SonarQube server 9.1.0
INFO: Default locale: "en_IN", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=162ms
INFO: Server id: BF41A1F2-AX0zI9epWE89Of-oTW0T
INFO: User cache: C:\Users\vansi\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=95ms
INFO: Load/download plugins (done) | time=309ms
INFO: Process project properties
INFO: Process project properties (done) | time=21ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=2ms
INFO: Project key: Altoro-J
INFO: Base dir: C:\Users\vansi\Downloads\AltoroJ-AltoroJ-3.2 (1)
INFO: Working dir: C:\Users\vansi\Downloads\AltoroJ-AltoroJ-3.2 (1)\.scannerwork
INFO: Load project settings for component key: 'Altoro-J'
INFO: Load project settings for component key: 'Altoro-J' (done) | time=35ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=110ms
INFO: Load active rules
INFO: Load active rules (done) | time=3237ms
WARN: SCM provider autodetection failed. Please use "sonar.scm.provider" to define SCM of your project, or disable the SCM Sensor in the project settings.
INFO: Indexing files...
INFO: Project configuration:
INFO: Load project repositories
INFO: Load project repositories (done) | time=26ms
INFO: 214 files indexed
INFO: Quality profile for css: Sonar way
INFO: Quality profile for java: Sonar way
INFO: Quality profile for js: Sonar way
INFO: Quality profile for jsp: Sonar way
INFO: Quality profile for web: Sonar way
INFO: Quality profile for xml: Sonar way
INFO: ------------- Run sensors on module Altoro-J
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=52ms
INFO: Sensor JavaSensor [java]
INFO: Configured Java source version (sonar.java.source): none
INFO: JavaClasspath initialization
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 11.058s
INFO: Final Memory: 13M/54M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution
org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.
        at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)
        at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:317)
        at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:175)
        at org.sonar.java.JavaFrontend.<init>(JavaFrontend.java:88)
        at org.sonar.plugins.java.JavaSensor.execute(JavaSensor.java:108)
        at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
        at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:79)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:382)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:378)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:347)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:136)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
        at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        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:189)
        at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
        at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
        at org.sonarsource.scanner.cli.Main.main(Main.java:61)
ERROR:
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

Solution

  • The error indicates that you have not provided the java binaries during the sonar execution.

    Add the below sonar.properties:

    sonar.java.binaries= **/*.java
    

    This will now scan your java binaries. This property is one of the required property if you are going to scan the java code.

    More details: https://docs.sonarqube.org/latest/analysis/languages/java/