在使用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
答案 0 :(得分:14)
Exception消息清楚地表明问题,但不是关于解决方案,它是:
在您定义sonar.sources
属性的同一位置,添加一个sonar.binaries
属性,该属性指向已编译代码的位置。例如,在maven项目中,您通常会sonar.binaries=target/classes
。
答案 1 :(得分:4)
在执行SonarQube Scanner下的jenkins作业配置中包含以下行:
sonar.java.binaries = $ {工作空间} /目标/类/
sonar.binaries = $ {工作空间} /目标/类/
答案 2 :(得分: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需要使用字节码来查找违规行为。