简体   繁体   中英

Sonarqube Source error in jenkins build

I am trying to analyze my project with sonarqube scanner in Jenkins. However when I'm building job it's always reporting some kind of an error, more exactly:

INFO: Option -e/--errors is no longer supported and will be ignored
INFO: Scanner configuration file: /var/jenkins_home/tools/hudson.plugins.sonar.SonarRunnerInstallation/SonarScanner1/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.0.3.778
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Linux 4.9.60-linuxkit-aufs amd64
INFO: User cache: /var/jenkins_home/.sonar/cache
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=232ms
INFO: Server id: AWEptYvpPRWpK4xbT0G4
INFO: User cache: /var/jenkins_home/.sonar/cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=124ms
INFO: SonarQube server 6.7.1
INFO: Default locale: "en", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Process project properties
ERROR: Invalid value of sonar.sources for test
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.218s
INFO: Final Memory: 42M/114M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: The folder 'polacpat/Documents/Jenkins2/workspace/SonarScanningTestProject/src/test' does not exist for 'test' (base directory = /var/jenkins_home/workspace/SonarScanningTestProject)
ERROR: 
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

Those are my Sonarqube analysis properties AnalysisProperties

This is location of my project, it's automatically created because code is from gitlab...

Project Location

Now I don't really understand how does this work and how should I configure it. I have added the same name to a new sonarqube project and also sonarqube project key I have created within a sonarqube which is connected with a jenkins to those analyse properties in here, I don't understand how exactly does this works...

Updated folder: Wrong Folder Being Analysed

Updated second error log after trying to set: sonar.sources=./src or
sonar.sources=./src/main

11:19:28.650 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.<init>(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:88)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:111)
    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)
11:19:28.651 DEBUG: Execution getVersion
11:19:28.656 DEBUG: Execution stop
ERROR: SonarQube scanner exited with non-zero code: 1
Finished: FAILURE

"Invalid value of sonar.sources for test"

sonar.sources must be relative to worskspace

sonar.sources=./src/test

And Please provide compiled classes of your project with sonar.java.binaries property means you need set sonar.java.binaries pointing to binaries

sonar.java.binaries=target/classes

See sonar paramenters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM