我有一个 java 项目,我希望对使用 Sonar 进行一些分析。
我有一个 build.xml 文件,其目标名为 sonar,它只是指出我的 sonar-ant-task.jar-file 所在的位置,剩下的就是:
<sonar:sonar workDir="${source.path}" key="${ant.project.name}" version="${version}" xmlns:sonar="antlib:org.sonar.ant">
当我运行它时,我得到了这个:
声纳:
[sonar:sonar] Apache Ant(TM) version 1.8.2 compiled on December 20 2010
[sonar:sonar] Sonar Ant Task version: 1.0
[sonar:sonar] Sonar work directory: PATH/src
[sonar:sonar] Sonar server: http://localhost:9000
[sonar:sonar] Sonar version: 3.0.1
[sonar:sonar] 09:16:47.958 INFO o.s.c.p.Database - Create JDBC datasource
[sonar:sonar] 09:16:48.672 INFO actDatabaseConnector - Initializing Hibernate
[sonar:sonar] 09:16:50.700 INFO .s.b.b.ProjectModule - ------------- Analyzing package
[sonar:sonar] 09:16:51.407 INFO .s.b.ProfileProvider - Selected quality profile : [name=Sonar way with Findbugs,language=java]
[sonar:sonar] 09:16:51.426 INFO nPluginsConfigurator - Configure maven plugins...
[sonar:sonar] 09:16:51.549 INFO org.sonar.INFO - Compare to previous analysis (2012-10-15)
[sonar:sonar] 09:16:51.588 INFO org.sonar.INFO - Compare over 5 days (2012-10-10, analysis of 2012-10-15 09:09:26.826)
[sonar:sonar] 09:16:51.621 INFO org.sonar.INFO - Compare over 30 days (2012-09-15, analysis of 2012-10-15 09:09:26.826)
[sonar:sonar] 09:16:51.664 INFO .b.p.SensorsExecutor - Initializer ProjectFileSystemLogger...
[sonar:sonar] 09:16:51.668 INFO .b.p.SensorsExecutor - Initializer ProjectFileSystemLogger done: 4 ms
[sonar:sonar] 09:16:51.679 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter...
[sonar:sonar] 09:16:51.713 INFO p.PhasesTimeProfiler - Sensor JavaSourceImporter done: 34 ms
[sonar:sonar] 09:16:51.713 INFO p.PhasesTimeProfiler - Sensor SquidSensor...
[sonar:sonar] 09:16:51.745 INFO .s.p.s.SquidExecutor - Java Squid scan...
[sonar:sonar] 09:16:51.749 INFO .s.p.s.SquidExecutor - Java Squid scan done: 4 ms
[sonar:sonar] 09:16:51.749 INFO p.PhasesTimeProfiler - Sensor SquidSensor done: 36 ms
[sonar:sonar] 09:16:51.750 INFO p.PhasesTimeProfiler - Sensor SurefireSensor...
[sonar:sonar] 09:16:51.751 INFO s.p.s.SurefireSensor - parsing PATH\src\target\surefire-reports
[sonar:sonar] 09:16:51.757 INFO p.PhasesTimeProfiler - Sensor SurefireSensor done: 7 ms
[sonar:sonar] 09:16:51.757 INFO p.PhasesTimeProfiler - Sensor CpdSensor...
[sonar:sonar] 09:16:51.757 INFO org.sonar.INFO - SonarEngine is used
[sonar:sonar] 09:16:51.758 INFO p.PhasesTimeProfiler - Sensor CpdSensor done: 0 ms
[sonar:sonar] 09:16:51.758 INFO p.PhasesTimeProfiler - Sensor ProfileSensor...
[sonar:sonar] 09:16:52.403 INFO p.PhasesTimeProfiler - Sensor ProfileSensor done: 645 ms
[sonar:sonar] 09:16:52.404 INFO p.PhasesTimeProfiler - Sensor ProfileEventsSensor...
[sonar:sonar] 09:16:52.435 INFO p.PhasesTimeProfiler - Sensor ProfileEventsSensor done: 31 ms
[sonar:sonar] 09:16:52.436 INFO p.PhasesTimeProfiler - Sensor VersionEventsSensor...
[sonar:sonar] 09:16:52.465 INFO p.PhasesTimeProfiler - Sensor VersionEventsSensor done: 29 ms
[sonar:sonar] 09:16:52.750 INFO p.PhasesTimeProfiler - Execute decorators...
[sonar:sonar] 09:16:52.910 INFO .b.p.UpdateStatusJob - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000
[sonar:sonar] 09:16:52.911 INFO b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
[sonar:sonar] 09:16:52.969 INFO b.p.PostJobsExecutor - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
[sonar:sonar] 09:16:52.982 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per day between 2012-09-17 and 2012-10-15
[sonar:sonar] 09:16:52.984 INFO DefaultPeriodCleaner - <- Delete snapshot: 2012-10-15T09:11:13+0200 [463]
[sonar:sonar] 09:16:53.006 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per week between 2011-10-17 and 2012-09-17
[sonar:sonar] 09:16:53.006 INFO .p.d.p.KeepOneFilter - -> Keep one snapshot per month between 2007-10-22 and 2011-10-17
[sonar:sonar] 09:16:53.007 INFO .d.p.DeleteAllFilter - -> Delete data prior to: 2007-10-22
[sonar:sonar] 09:16:53.011 INFO o.s.c.purge.PurgeDao - -> Clean package [id=404]
BUILD SUCCESSFUL
Total time: 7 seconds
当我浏览到http://localhost:9000
我可以看到带有我的项目的 Sonar 仪表板但没有分析任何行时,它都是空的,并且代码覆盖率显示为“-”。
有任何想法吗?
谢谢!