我已经在 linux 机器上安装了声纳并配置了 mysql 服务器。
从声纳站点下载了示例项目
- 在 .m2 文件夹的 settings.xml 中添加了声纳详细信息
- mvn clean install - 构建成功
- 声纳:声纳 - 建立成功
我使用了下载项目 https://codeload.github.com/SonarSource/sonar-examples/legacy.zip/master中给出的相同 pom.xml 文件
安慰 :
[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. 上面的项目在dashboard中列出。但是仪表板中没有列出任何问题。相反,它显示为 0。 2. 项目覆盖率设置为 0%,因为没有包含类的目录。
我哪里错了.. ??
提前致谢
注意:一开始我从我的实时项目开始进行分析。在遇到很多问题后,我从一个示例项目开始。