配置项目后,SonarQube未在仪表板中显示任何问题

时间:2013-10-21 15:45:19

标签: java mysql sonarqube

我在linux机器上安装了声纳并配置了mysql服务器。

从声纳站点下载示例项目

  1. 在.m2文件夹
  2. 中的settings.xml中添加了声纳详细信息
  3. mvn clean install - BUILD SUCCESS
  4. 声纳:声纳 - 建立成功
  5. 我使用了下载项目中给出的相同pom.xml文件 https://codeload.github.com/SonarSource/sonar-examples/legacy.zip/master

    控制台:

    [INFO] ------------------------------------------------------------------------
    [INFO] Building UT coverage with Maven reusing JUnit and JaCoCo reports 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO] 
    [INFO] --- sonar-maven-plugin:2.1:sonar (default-cli) @ example-ut-maven-jacoco-reuseReports ---
    [INFO] SonarQube version: 3.7.1
    INFO: Default locale: "en_US", source code encoding: "UTF-8"
    INFO: Work directory: D:\TestWS\java-maven-simple\target\sonar
    INFO: SonarQube Server 3.7.1
    [INFO] [21:03:10.910] Load batch settings
    [INFO] [21:03:11.043] User cache: C:\Users\user\.sonar\cache
    [INFO] [21:03:11.046] Install plugins
    [INFO] [21:03:12.549] Install JDBC driver
    [INFO] [21:03:12.555] Create JDBC datasource for jdbc:mysql://serverip:3306/sonar?useUnicode=true&characterEncoding=utf8
    [INFO] [21:03:14.889] Initializing Hibernate
    [INFO] [21:03:18.154] Load project settings
    [INFO] [21:03:18.188] Apply project exclusions
    [INFO] [21:03:18.346] -------------  Scan UT coverage with Maven reusing JUnit and JaCoCo reports
    [INFO] [21:03:18.359] Load module settings
    [INFO] [21:03:19.288] Quality profile : [name=Stella,language=java]
    [INFO] [21:03:19.315] Excluded tests: 
    [INFO] [21:03:19.315]   **/package-info.java
    [INFO] [21:03:19.365] Configure Maven plugins
    [INFO] [21:03:19.435] Compare to previous analysis (2013-10-21)
    [INFO] [21:03:19.450] Compare over 30 days (2013-09-21, analysis of 2013-10-21 20:01:17.0)
    [INFO] [21:03:19.460] Compare to previous version
    [INFO] [21:03:19.546] Base dir: D:\TestWS\java-maven-simple
    [INFO] [21:03:19.547] Working dir: D:\TestWS\java-maven-simple\target\sonar
    [INFO] [21:03:19.547] Source dirs: D:\TestWS\java-maven-simple\src\main\java
    [INFO] [21:03:19.547] Binary dirs: D:\TestWS\java-maven-simple\target\classes
    [INFO] [21:03:19.547] Source encoding: UTF-8, default locale: en_US
    [INFO] [21:03:19.550] Sensor JavaSourceImporter...
    [INFO] [21:03:19.551] Sensor JavaSourceImporter done: 1 ms
    [INFO] [21:03:19.551] Sensor JavaSquidSensor...
    [INFO] [21:03:19.551] Sensor JavaSquidSensor done: 0 ms
    [INFO] [21:03:19.551] Sensor SurefireSensor...
    [INFO] [21:03:19.552] parsing D:\TestWS\java-maven-simple\reports\junit
    [INFO] [21:03:19.554] Sensor SurefireSensor done: 3 ms
    [INFO] [21:03:19.554] Sensor CpdSensor...
    [INFO] [21:03:19.554] SonarEngine is used
    [INFO] [21:03:19.555] Sensor CpdSensor done: 1 ms
    [INFO] [21:03:19.555] Sensor InitialOpenIssuesSensor...
    [INFO] [21:03:19.560] Sensor InitialOpenIssuesSensor done: 5 ms
    [INFO] [21:03:19.560] Sensor ProfileSensor...
    [INFO] [21:03:19.818] Sensor ProfileSensor done: 258 ms
    [INFO] [21:03:19.818] Sensor ProfileEventsSensor...
    [INFO] [21:03:19.845] Sensor ProfileEventsSensor done: 27 ms
    [INFO] [21:03:19.845] Sensor ProjectLinksSensor...
    [INFO] [21:03:19.854] Sensor ProjectLinksSensor done: 9 ms
    [INFO] [21:03:19.855] Sensor VersionEventsSensor...
    [INFO] [21:03:19.874] Sensor VersionEventsSensor done: 19 ms
    [INFO] [21:03:19.874] Sensor Maven dependencies...
    [INFO] [21:03:19.880] Sensor Maven dependencies done: 6 ms
    [INFO] [21:03:19.880] Sensor JaCoCoSensor...
    [INFO] [21:03:19.882] Project coverage is set to 0% since there is no directories with classes.
    [INFO] [21:03:19.882] Sensor JaCoCoSensor done: 2 ms
    [INFO] [21:03:20.087] Execute decorators...
    [INFO] [21:03:20.283] Store results in database
    [INFO] [21:03:20.329] ANALYSIS SUCCESSFUL, you can browse http://serverip:9090/dashboard/index/org.codehaus.sonar:example-ut-maven-jacoco-reuseReports
    [INFO] [21:03:20.362] Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
    [INFO] [21:03:20.362] Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
    [INFO] [21:03:20.478] Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
    [INFO] [21:03:20.487] -> Keep one snapshot per day between 2013-09-23 and 2013-10-20
    [INFO] [21:03:20.488] -> Keep one snapshot per week between 2012-10-22 and 2013-09-23
    [INFO] [21:03:20.488] -> Keep one snapshot per month between 2008-10-27 and 2012-10-22
    [INFO] [21:03:20.489] -> Delete data prior to: 2008-10-27
    [INFO] [21:03:20.493] -> Clean UT coverage with Maven reusing JUnit and JaCoCo reports [id=3300]
    [INFO] [21:03:20.498] <- Clean snapshot 14204
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    

    在此之后,导航到http://serverip:9090。 1.上述项目列在仪表板中。但仪表板中未列出任何问题。而是显示0。 2.项目覆盖率设置为0%,因为没有带类的目录。

    我哪里出错.. ??

    提前致谢

    注意: 一开始我开始使用我的实时项目进行分析。面对很多问题后,我开始了一个示例项目。

2 个答案:

答案 0 :(得分:0)

在运行“mvn sonar:sonar”之前,您的“目标”目录似乎已被清理。

答案 1 :(得分:0)

搜索了在Sonar仪表板中管理maven测试项目的解决方案,我没有找到合适的方法。所以我转到了Sonar Runner,这很容易在Sonar仪表板中配置和管理测试项目。