4

使用 findbugs 配置我的声纳项目后出现以下错误。请帮帮我。

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
4

3 回答 3

15

异常消息清楚地说明了问题,但没有说明解决方案,即:在您定义sonar.sources属性的同一位置,添加一个sonar.binaries指向已编译代码位置的属性。例如,在一个 Maven 项目中,您通常会拥有sonar.binaries=target/classes.

于 2014-02-11T20:37:32.207 回答
5

在执行 SonarQube Scanner 下的 jenkins 作业配置中包括以下行:

sonar.java.binaries=${workspace}/target/classes/

sonar.binaries=${workspace}/target/classes/

于 2016-08-02T07:29:18.830 回答
3

这个问题很清楚:

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.

FindBugs 确实需要字节码来查找违规行为。

于 2013-05-23T11:37:44.533 回答