简体   繁体   中英

SonarQube is not showing any issues in the Dashboard after configuring projects

I have installed sonar and configured mysql server in linux machine.

Downloaded the sample project from sonar site

  1. Added the sonar details in settings.xml in .m2 folder
  2. mvn clean install - BUILD SUCCESS
  3. sonar:sonar - BUILD SUCCESS

I have used the same pom.xml file given in downloaded project https://codeload.github.com/SonarSource/sonar-examples/legacy.zip/master

Console :

[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] ------------------------------------------------------------------------

After this, navigated to http://serverip:9090 . 1. The above project is listed in the dashboard. But no issues are listed in dashboard. instead its showing 0. 2. Project coverage is set to 0% since there is no directories with classes.

Where am i going wrong.. ??

Thanks in advance

Note : At the beginning i started with my real-time project for the analysis. after facing lot of issues, i started with a sample project.

看起来您的“目标”目录在运行“ mvn sonar:sonar”之前已被清理。

Searched for a solution to manage a maven test project in Sonar dashboard, I didn't found a proper way to do it. So I moved to Sonar Runner which is pretty easy to configure and manage the test project in Sonar dashboard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM