我是以下情况。
我正在使用声纳(通过和),当我使用“声纳方式”时,它运行得很好。
我想运行“使用Findbugz的声纳方式”-profile,但我得到一个例外而且它不起作用。
是什么让这更加困难 - 不要问为什么只是不 - 我只有.java文件可以使用和很多项目,编译不是一个选项。
有没有办法在未编译的文件上运行FingBugs? 还有其他建议吗?我全都耳朵......
输出:
Buildfile:build.xml
sonar:
[sonar:sonar] Apache Ant version 1.7.1 compiled on August 24 2010
[sonar:sonar] Sonar Ant Task version: 1.0
[sonar:sonar] Loaded from: file:/usr/share/ant/lib/sonar-ant-task.jar
[sonar:sonar] Sonar work directory: /folder
[sonar:sonar] Sonar server: http://localhost:9000
[sonar:sonar] Sonar version: 3.5
[sonar:sonar] 13:54:34.062 INFO .s.b.b.BatchSettings - Load batch settings
[sonar:sonar] 13:54:34.114 INFO o.s.h.c.FileCache - User cache: /home/proj/.sonar/cache
[sonar:sonar] 13:54:34.131 INFO atchPluginRepository - Install plugins
[sonar:sonar] 13:54:34.696 INFO .s.b.b.TaskContainer - ------------- Executing Project Scan
[sonar:sonar] 13:54:35.199 INFO b.b.JdbcDriverHolder - Install JDBC driver
[sonar:sonar] 13:54:35.201 INFO .b.ProjectExclusions - Apply project exclusions
[sonar:sonar] 13:54:35.205 INFO o.s.c.p.Database - Create JDBC datasource for jdbc:postgresql://localhost/sonar
[sonar:sonar] 13:54:35.292 INFO actDatabaseConnector - Initializing Hibernate
[sonar:sonar] 13:54:38.035 INFO .s.b.s.ScanContainer - ------------- Inspecting proj
[sonar:sonar] 13:54:38.039 INFO .b.b.ProjectSettings - Load module settings
[sonar:sonar] 13:54:39.021 INFO .s.b.ProfileProvider - Quality profile : [name=Sonar way with Findbugs,language=java]
[sonar:sonar] 13:54:39.037 INFO s.f.ExclusionFilters - Excluded tests:
[sonar:sonar] 13:54:39.037 INFO s.f.ExclusionFilters - **/package-info.java
[sonar:sonar] 13:54:39.066 INFO nPluginsConfigurator - Configure Maven plugins
[sonar:sonar] 13:54:39.256 INFO org.sonar.INFO - Compare to previous analysis (2013-03-25)
[sonar:sonar] 13:54:39.321 INFO org.sonar.INFO - Compare over 5 days (2013-03-20, analysis of 2013-03-25 09:55:51.594)
[sonar:sonar] 13:54:39.375 INFO org.sonar.INFO - Compare over 30 days (2013-02-23, analysis of 2013-03-25 09:55:51.594)
[sonar:sonar] 13:54:39.542 INFO .b.p.SensorsExecutor - Initializer JacocoAntInitializer...
[sonar:sonar] 13:54:39.602 INFO o.s.p.j.JaCoCoPlugin - JaCoCo agent (version 0.6.2.201302030002) extracted: /tmp/jacocoagent973279373506480907.jar
[sonar:sonar] 13:54:39.602 INFO .b.p.SensorsExecutor - Initializer JacocoAntInitializer done: 60 ms
[sonar:sonar] 13:54:39.602 INFO s.f.FileSystemLogger - Base dir: /../..
[sonar:sonar] 13:54:39.602 INFO s.f.FileSystemLogger - Working dir: /../../usr/local/repository/org/src
[sonar:sonar] 13:54:39.603 INFO s.f.FileSystemLogger - Source dirs: /usr/local/repository/proj/org/src
[sonar:sonar] 13:54:39.603 INFO s.f.FileSystemLogger - Binary dirs: /usr/local/repository/proj/org/bin
[sonar:sonar] 13:54:39.603 WARN s.f.FileSystemLogger - Source encoding is platform dependent (UTF-8), default locale: en_US
[sonar:sonar] 13:54:39.668 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter...
[sonar:sonar] 13:54:39.950 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter done: 282 ms
[sonar:sonar] 13:54:39.951 INFO p.PhasesTimeProfiler - Sensor JavaSquidSensor...
[sonar:sonar] 13:54:40.237 INFO o.s.java.JavaSquid - Java AST scan...
[sonar:sonar] 13:54:42.784 INFO o.s.java.JavaSquid - Java AST scan done: 2547 ms
[sonar:sonar] 13:54:42.964 INFO p.PhasesTimeProfiler - Sensor JavaSquidSensor done: 3013 ms
[sonar:sonar] 13:54:42.965 INFO p.PhasesTimeProfiler - Sensor FindbugsSensor...
[sonar:sonar] 13:54:42.965 INFO org.sonar.INFO - Execute Findbugs 2.0.1...
BUILD FAILED
org.sonar.api.utils.SonarException: Can not execute Findbugs
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:149)
at org.sonar.plugins.findbugs.FindbugsSensor.analyse(FindbugsSensor.java:62)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
at org.sonar.batch.phases.Phases.execute(Phases.java:101)
at org.sonar.batch.scan.ScanContainer.doStart(ScanContainer.java:147)
at org.sonar.batch.bootstrap.Container.start(Container.java:72)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:65)
at org.sonar.batch.scan.ScanTask.scanRecursively(ScanTask.java:56)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:49)
at org.sonar.batch.bootstrap.TaskContainer.doStart(TaskContainer.java:188)
at org.sonar.batch.bootstrap.Container.start(Container.java:72)
at org.sonar.batch.bootstrap.TaskBootstrapContainer.executeTask(TaskBootstrapContainer.java:73)
at org.sonar.batch.bootstrap.TaskBootstrapContainer.doStart(TaskBootstrapContainer.java:62)
at org.sonar.batch.bootstrap.Container.start(Container.java:72)
at org.sonar.batch.bootstrap.BootstrapContainer.doStart(BootstrapContainer.java:104)
at org.sonar.batch.bootstrap.Container.start(Container.java:72)
at org.sonar.batch.Batch.execute(Batch.java:106)
at org.sonar.ant.Launcher.executeBatch(Launcher.java:121)
at org.sonar.ant.Launcher.execute(Launcher.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.sonar.ant.SonarTask.delegateExecution(SonarTask.java:167)
at org.sonar.ant.SonarTask.execute(SonarTask.java:151)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
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.
at org.sonar.plugins.findbugs.FindbugsConfiguration.getFindbugsProject(FindbugsConfiguration.java:84)
at org.sonar.plugins.findbugs.FindbugsExecutor.execute(FindbugsExecutor.java:107)
... 40 more
Total time: 14 seconds
答案 0 :(得分:2)
不,这是不可能的:Findbugs依赖字节码来执行代码分析。因此,如果您尚未编译代码,则无法在其上运行Findbugs。