findbug 3.4.4 failed to work with sonarqube 5.6

1,052 views
Skip to first unread message

stanle...@servicemax.com

unread,
Sep 20, 2016, 12:34:49 PM9/20/16
to SonarQube
hello all

We had sonar scan for a java project, which is organized by maven and there are multiple modules.
we once used sonarqube 5.4 and seems findbug 3.1, at that time. 
The scan works well though we didn't compile the source code.
But we can see warning like this 

22:22:24 22:23:04.877 [main] WARN  o.s.plugins.findbugs.FindbugsSensor - Findbugs needs sources to be compiled. Please build project before executing sonar or check the location of compiled classes to make it possible for Findbugs to analyse your project.
22:22:24 INFO: Sensor org.sonar.plugins.findbugs.FindbugsSensor (done) | time=10ms


Recently we upgraded sonarqube to 5.6 and findbug to 3.4.3, and then it failed to work,  the scan kept failing at findbug plugin with blow errors

3:23:22 ERROR: Error during SonarQube Scanner execution
13:23:22 java.lang.IllegalStateException: Can not execute Findbugs
13:23:22        at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:169)
13:23:22        at org.sonar.plugins.findbugs.FindbugsSensor.execute(FindbugsSensor.java:88)
13:23:22        at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
13:23:22        at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
13:23:22        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
13:23:22        at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
13:23:22        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
13:23:22        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
13:23:22        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
13:23:22        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
13:23:22        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
13:23:22        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
13:23:22        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
13:23:22        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
13:23:22        at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
13:23:22        at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
13:23:22        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
13:23:22        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
13:23:22        at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
13:23:22        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
13:23:22        at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62)
13:23:22        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
13:23:22        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
13:23:22        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
13:23:22        at java.lang.reflect.Method.invoke(Method.java:498)
13:23:22        at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
13:23:22        at com.sun.proxy.$Proxy0.execute(Unknown Source)
13:23:22        at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:244)
13:23:22        at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:154)
13:23:22        at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110)
13:23:22        at org.sonarsource.scanner.cli.Main.execute(Main.java:72)
13:23:22        at org.sonarsource.scanner.cli.Main.main(Main.java:60)
13:23:22 Caused by: java.lang.IllegalStateException: This project contains Java source files that are not compiled.
13:23:22        at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:120)
13:23:22        at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:119)
13:23:22        ... 31 more
13:23:22 Build step 'Execute shell' marked build as failure



I tried to google it, someone mentiond we can add properties like 
"sonar.binaries=prj1/**/target/classes/" etc but it seems didn't work for me.

Here is my original properties file
sonar.projectKey=test
sonar.projectName=test (Java Code)
sonar.projectVersion=${git_branch}_${git_id}
sonar.sourceEncoding=UTF-8

sonar.login=admin
sonar.password=password

sonar.language=java
sonar.profile=JAVA
sonar.java.libraries=proj/**/*.jar

sonar.sources= proj
sonar.exclusions= proj/test_suite/**/*.java, proj/**/src/test/**, proj/testutils/**/*.java, proj/polyglot.ruby/src/main/resources/**/*.java
sonar.jacoco.reportMissing.force.zero=true
sonar.dependencyCheck.reportPath=dependency-check-report.xml




Any suggestion to fix the issue?
Thanks in advance.



Regards,
Stanley








G. Ann Campbell

unread,
Sep 20, 2016, 2:28:25 PM9/20/16
to SonarQube, stanle...@servicemax.com
Hi Stanley,

Since FindBugs analyzes bytecode and only bytecode, it has always been required for successful FindBugs analysis. Now that's more obvious. :-)

Regarding your properties file, I don't actually see a property that points to your binaries...?


Ann

Stanley Shen

unread,
Sep 20, 2016, 2:39:33 PM9/20/16
to G. Ann Campbell, SonarQube
Yes, the post properties file doesn't have it.

I tried to compile the project and add property like "sonar.binaries=prj1/**/target/classes/" etc but it doesn't work for me.
I still see the error.

I didn't find a workable solution yet,  so I am wondering what could be the correct way to make it work?


Regards,
Stanley




G. Ann Campbell

unread,
Sep 20, 2016, 3:05:40 PM9/20/16
to SonarQube, ann.ca...@sonarsource.com, stanle...@servicemax.com
Hi Stanley,

Try using `sonar.java.binaries` (I should have mentioned that before. If that doesn't work, take a look at the plugin's issues. This sounds kinda familiar.


Ann
Reply all
Reply to author
Forward
0 new messages