Error in Sonar while executing Findbug rules
11,802
Solution 1
The Exception message is clear about the problem, but not about the solution, which is:
at the same place where you defined the sonar.sources
property, add a sonar.binaries
property that points to the location of the compiled code. For example, in a maven project you would typically have sonar.binaries=target/classes
.
Solution 2
Include the below lines in the jenkins job configuration under execute SonarQube Scanner:
sonar.java.binaries=${workspace}/target/classes/
sonar.binaries=${workspace}/target/classes/
Solution 3
The issue is pretty clear:
Caused by: org.sonar.api.utils.SonarException: Findbugs needs sources to be compiled. Please build project before executing sonar and check the location of compiled classes.
Indeed FindBugs needs bytecode to look for violations.
Author by
Amit Kumar
Updated on June 17, 2022Comments
-
Amit Kumar almost 2 years
I'm getting following error after configuring my sonar project with findbugs. Please help me out.
BUILD FAILED 17-May-2013 11:18:15 /home/build/bamboo-home/xml-data/build-dir/EZIO-EMA-JOB1/build.xml:247: org.sonar.api.utils.SonarException: Can not execute Findbugs 17-May-2013 11:18:15 at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:120) 17-May-2013 11:18:15 at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:58) 17-May-2013 11:18:15 at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64) 17-May-2013 11:18:15 at org.sonar.batch.phases.Phases.execute(Phases.java:93) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.Module.start(Module.java:89) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:110) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:100) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.Module.start(Module.java:89) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96) 17-May-2013 11:18:15 at org.sonar.batch.bootstrap.Module.start(Module.java:89) 17-May-2013 11:18:15 at org.sonar.batch.Batch.execute(Batch.java:74) 17-May-2013 11:18:15 at org.sonar.ant.Launcher.execute(Launcher.java:70) 17-May-2013 11:18:15 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 17-May-2013 11:18:15 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 17-May-2013 11:18:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 17-May-2013 11:18:15 at java.lang.reflect.Method.invoke(Method.java:597) 17-May-2013 11:18:15 at org.sonar.ant.SonarTask.delegateExecution(SonarTask.java:202) 17-May-2013 11:18:15 at org.sonar.ant.SonarTask.execute(SonarTask.java:186) 17-May-2013 11:18:15 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 17-May-2013 11:18:15 at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 17-May-2013 11:18:15 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 17-May-2013 11:18:15 at java.lang.reflect.Method.invoke(Method.java:597) 17-May-2013 11:18:15 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) 17-May-2013 11:18:15 at org.apache.tools.ant.Task.perform(Task.java:348) 17-May-2013 11:18:15 at org.apache.tools.ant.Target.execute(Target.java:390) 17-May-2013 11:18:15 at org.apache.tools.ant.Target.performTasks(Target.java:411) 17-May-2013 11:18:15 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1360) 17-May-2013 11:18:15 at org.apache.tools.ant.Project.executeTarget(Project.java:1329) 17-May-2013 11:18:15 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) 17-May-2013 11:18:15 at org.apache.tools.ant.Project.executeTargets(Project.java:1212) 17-May-2013 11:18:15 at org.apache.tools.ant.Main.runBuild(Main.java:801) 17-May-2013 11:18:15 at org.apache.tools.ant.Main.startAnt(Main.java:218) 17-May-2013 11:18:15 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) 17-May-2013 11:18:15 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) 17-May-2013 11:18:15 Caused by: org.sonar.api.utils.SonarException: Findbugs needs sources to be compiled. Please build project before executing sonar and check the location of compiled classes. 17-May-2013 11:18:15 at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:66) 17-May-2013 11:18:15 at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:74) 17-May-2013 11:18:15 ... 34 more
-
Amit Kumar almost 11 yearswe are using ant to build project and compiled classes are in bin folder do I need to put some extra tags in build.xml to make it work. Please guide me. Thanks
-
Amit Kumar almost 11 yearswe are using sonar version 2.11 and jdk version as 1.6.0_29. We are using custom quality rule including PMD, checkstyle and findbugs. I upload this file in sonar and link it to particular project.
-
Amit Kumar almost 11 yearsCan anybody help me out ??
-
Freddy - SonarSource Team almost 11 years@AmitKumar, I guess you haven't correctly set the value of the 'sonar.binaries' property
-
yvolk about 10 yearsThank you, I changed sonar.binaries to bin/classes (in my case, for Android) and it worked!
-
MeowRude over 7 years@melhior Welcome!