0

Have just started to use SonarQube for a university project. I have successfully analysed some sample projects (https://github.com/SonarSource/sonar-scanning-examples). When I enter http://localhost:9000 in my browser I can see the results perfectly.

However when I try to run the scan on the maven project https://www.openmrs.org, the scanner seems to run successfully, but I can see no results in the browser.

This is the progress log:

D:\openmrs-core>mvn sonar:sonar
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] OpenMRS
[INFO] openmrs-tools
[INFO] openmrs-test
[INFO] openmrs-api
[INFO] openmrs-web
[INFO] openmrs-webapp
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no
 dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-map
ping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its depende
ncies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:j
ar:1.0.0 in http://mavenrepo.openmrs.org/nexus/content/repositories/public was c
ached in the local repository, resolution will not be reattempted until the upda
te interval of openmrs-repo has elapsed or updates are forced
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OpenMRS 2.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no
 dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-map
ping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its depende
ncies could not be resolved: Failure to find org.eclipse.m2e:lifecycle-mapping:j
ar:1.0.0 in http://mavenrepo.openmrs.org/nexus/content/repositories/public was c
ached in the local repository, resolution will not be reattempted until the upda
te interval of openmrs-repo has elapsed or updates are forced
[INFO]
[INFO] --- sonar-maven-plugin:4.5.4:sonar (default-cli) @ openmrs ---
INFO: Default locale: "en_GB", source code encoding: "UTF-8"
INFO: Work directory: D:\openmrs-core\target\sonar
INFO: SonarQube Server 4.5.4
[INFO] [14:41:24.624] Load global referentials...
[INFO] [14:41:25.711] Load global referentials done: 1092 ms
[INFO] [14:41:25.712] Incremental mode
[INFO] [14:41:25.730] User cache: C:\Users\ALI\.sonar\cache
[INFO] [14:41:25.745] Install plugins
[INFO] [14:41:25.920] Include plugins: buildbreaker
[INFO] [14:41:25.920] Exclude plugins: devcockpit, buildstability, pdfreport, re
port, buildbreaker, scmactivity, views, jira
[INFO] [14:42:21.436] Create JDBC datasource for jdbc:h2:D:\openmrs-core\target\
sonar\.sonartmp\preview1508416887090-0
[INFO] [14:42:22.792] Initializing Hibernate
[INFO] [14:42:24.835] Load project referentials...
[INFO] [14:42:28.280] Load project referentials done: 3445 ms
[INFO] [14:42:28.282] Load project settings
[INFO] [14:42:28.607] Loading technical debt model...
[INFO] [14:42:28.675] Loading technical debt model done: 68 ms
[INFO] [14:42:28.683] Apply project exclusions
[INFO] [14:42:29.194] -------------  Scan openmrs-tools
[INFO] [14:42:29.198] Load module settings
[INFO] [14:42:29.831] Loading rules...
[INFO] [14:42:30.027] Loading rules done: 196 ms
[INFO] [14:42:30.075] Configure Maven plugins
[INFO] [14:42:30.257] Compare to previous analysis (2017-10-18)
[INFO] [14:42:30.272] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:30.282] Compare to previous version (2017-03-03)
[INFO] [14:42:30.471] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:30.655] Initializer FindbugsMavenInitializer...
[INFO] [14:42:30.655] Initializer FindbugsMavenInitializer done: 0 ms
[INFO] [14:42:30.656] Base dir: D:\openmrs-core\tools
[INFO] [14:42:30.656] Working dir: D:\openmrs-core\tools\target\sonar
[INFO] [14:42:30.657] Source paths: src/main/java
[INFO] [14:42:30.657] Binary dirs: target/classes
[INFO] [14:42:30.657] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:30.658] Index files
[INFO] [14:42:30.733] 0 files indexed
[INFO] [14:42:30.757] Sensor QProfileSensor...
[INFO] [14:42:30.778] Sensor QProfileSensor done: 20 ms
[INFO] [14:42:30.780] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:30.924] Sensor InitialOpenIssuesSensor done: 144 ms
[INFO] [14:42:30.925] Sensor ProjectLinksSensor...
[INFO] [14:42:30.944] Sensor ProjectLinksSensor done: 19 ms
[INFO] [14:42:30.946] Sensor Maven dependencies...
[INFO] [14:42:30.985] Sensor Maven dependencies done: 39 ms
[INFO] [14:42:30.986] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:30.986] Sensor CPD Sensor (wrapped) done: 0 ms
[INFO] [14:42:31.283] Execute decorators...
[INFO] [14:42:31.396] -------------  Scan openmrs-test
[INFO] [14:42:31.398] Load module settings
[INFO] [14:42:31.443] Configure Maven plugins
[INFO] [14:42:31.444] Compare to previous analysis (2017-10-18)
[INFO] [14:42:31.445] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:31.446] Compare to previous version (2017-03-03)
[INFO] [14:42:32.342] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:32.383] Initializer FindbugsMavenInitializer...
[INFO] [14:42:32.385] Initializer FindbugsMavenInitializer done: 2 ms
[INFO] [14:42:32.385] Base dir: D:\openmrs-core\test
[INFO] [14:42:32.385] Working dir: D:\openmrs-core\test\target\sonar
[INFO] [14:42:32.386] Binary dirs: target/classes
[INFO] [14:42:32.386] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:32.386] Index files
[INFO] [14:42:32.388] 0 files indexed
[INFO] [14:42:32.394] Sensor QProfileSensor...
[INFO] [14:42:32.396] Sensor QProfileSensor done: 2 ms
[INFO] [14:42:32.396] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:32.447] Sensor InitialOpenIssuesSensor done: 51 ms
[INFO] [14:42:32.449] Sensor ProjectLinksSensor...
[INFO] [14:42:32.461] Sensor ProjectLinksSensor done: 12 ms
[INFO] [14:42:32.461] Sensor Maven dependencies...
[INFO] [14:42:32.776] Sensor Maven dependencies done: 315 ms
[INFO] [14:42:32.776] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:32.777] Sensor CPD Sensor (wrapped) done: 1 ms
[INFO] [14:42:32.867] Execute decorators...
[INFO] [14:42:32.888] -------------  Scan openmrs-api
[INFO] [14:42:32.890] Load module settings
[INFO] [14:42:32.923] Configure Maven plugins
[INFO] [14:42:32.924] Compare to previous analysis (2017-10-18)
[INFO] [14:42:32.925] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:32.925] Compare to previous version (2017-03-03)
[INFO] [14:42:33.146] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:33.183] Initializer FindbugsMavenInitializer...
[INFO] [14:42:33.183] Initializer FindbugsMavenInitializer done: 0 ms
[INFO] [14:42:33.184] Base dir: D:\openmrs-core\api
[INFO] [14:42:33.184] Working dir: D:\openmrs-core\api\target\sonar
[INFO] [14:42:33.185] Source paths: src/main/java
[INFO] [14:42:33.185] Test paths: src/test/java
[INFO] [14:42:33.186] Binary dirs: target/classes
[INFO] [14:42:33.186] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:33.186] Index files
[INFO] [14:42:33.186] Excluded sources:
[INFO] [14:42:33.186]   src/main/java/org/openmrs/arden/**/*
[INFO] [14:42:33.732] 0 files indexed
[INFO] [14:42:33.737] Sensor QProfileSensor...
[INFO] [14:42:33.737] Sensor QProfileSensor done: 0 ms
[INFO] [14:42:33.737] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:34.293] Sensor InitialOpenIssuesSensor done: 556 ms
[INFO] [14:42:34.294] Sensor ProjectLinksSensor...
[INFO] [14:42:34.301] Sensor ProjectLinksSensor done: 7 ms
[INFO] [14:42:34.305] Sensor Maven dependencies...
[INFO] [14:42:35.656] Sensor Maven dependencies done: 1351 ms
[INFO] [14:42:35.658] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:35.658] Sensor CPD Sensor (wrapped) done: 0 ms
[INFO] [14:42:35.727] Execute decorators...
[INFO] [14:42:36.202] -------------  Scan openmrs-web
[INFO] [14:42:36.203] Load module settings
[INFO] [14:42:36.235] Configure Maven plugins
[INFO] [14:42:36.237] Compare to previous analysis (2017-10-18)
[INFO] [14:42:36.238] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:36.239] Compare to previous version (2017-03-03)
[INFO] [14:42:36.415] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:36.445] Initializer FindbugsMavenInitializer...
[INFO] [14:42:36.446] Initializer FindbugsMavenInitializer done: 1 ms
[INFO] [14:42:36.446] Base dir: D:\openmrs-core\web
[INFO] [14:42:36.446] Working dir: D:\openmrs-core\web\target\sonar
[INFO] [14:42:36.447] Source paths: src/main/java
[INFO] [14:42:36.448] Test paths: src/test/java
[INFO] [14:42:36.448] Binary dirs: target/classes
[INFO] [14:42:36.448] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:36.448] Index files
[INFO] [14:42:36.488] 0 files indexed
[INFO] [14:42:36.491] Sensor QProfileSensor...
[INFO] [14:42:36.492] Sensor QProfileSensor done: 1 ms
[INFO] [14:42:36.492] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:36.559] Sensor InitialOpenIssuesSensor done: 67 ms
[INFO] [14:42:36.560] Sensor ProjectLinksSensor...
[INFO] [14:42:36.570] Sensor ProjectLinksSensor done: 10 ms
[INFO] [14:42:36.570] Sensor Maven dependencies...
[INFO] [14:42:38.222] Sensor Maven dependencies done: 1652 ms
[INFO] [14:42:38.224] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:38.224] Sensor CPD Sensor (wrapped) done: 0 ms
[INFO] [14:42:38.304] Execute decorators...
[INFO] [14:42:38.339] -------------  Scan openmrs-webapp
[INFO] [14:42:38.341] Load module settings
[INFO] [14:42:38.367] Configure Maven plugins
[INFO] [14:42:38.368] Compare to previous analysis (2017-10-18)
[INFO] [14:42:38.369] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:38.370] Compare to previous version (2017-03-03)
[INFO] [14:42:38.811] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:38.838] Initializer FindbugsMavenInitializer...
[INFO] [14:42:38.839] Initializer FindbugsMavenInitializer done: 1 ms
[INFO] [14:42:38.839] Base dir: D:\openmrs-core\webapp
[INFO] [14:42:38.839] Working dir: D:\openmrs-core\webapp\target\sonar
[INFO] [14:42:38.841] Test paths: src/test/java
[INFO] [14:42:38.841] Binary dirs: target/classes
[INFO] [14:42:38.841] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:38.841] Index files
[INFO] [14:42:38.845] 0 files indexed
[INFO] [14:42:38.847] Sensor QProfileSensor...
[INFO] [14:42:38.848] Sensor QProfileSensor done: 1 ms
[INFO] [14:42:38.849] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:38.867] Sensor InitialOpenIssuesSensor done: 18 ms
[INFO] [14:42:38.868] Sensor ProjectLinksSensor...
[INFO] [14:42:38.879] Sensor ProjectLinksSensor done: 11 ms
[INFO] [14:42:38.880] Sensor Maven dependencies...
[INFO] [14:42:39.158] Sensor Maven dependencies done: 278 ms
[INFO] [14:42:39.159] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:39.160] Sensor CPD Sensor (wrapped) done: 1 ms
[INFO] [14:42:39.221] Execute decorators...
[INFO] [14:42:39.233] -------------  Scan OpenMRS
[INFO] [14:42:39.235] Load module settings
[INFO] [14:42:39.259] Configure Maven plugins
[INFO] [14:42:39.264] Compare to previous analysis (2017-10-18)
[INFO] [14:42:39.274] Compare over 30 days (2017-09-19, analysis of 2017-09-22 1
0:38:19.0)
[INFO] [14:42:39.275] Compare to previous version (2017-03-03)
[INFO] [14:42:39.865] Loaded quality gate 'OpenMRS Gate'
[INFO] [14:42:39.896] Initializer FindbugsMavenInitializer...
[INFO] [14:42:39.896] Initializer FindbugsMavenInitializer done: 0 ms
[INFO] [14:42:39.897] Base dir: D:\openmrs-core
[INFO] [14:42:39.897] Working dir: D:\openmrs-core\target\sonar
[INFO] [14:42:39.897] Binary dirs: target/classes
[INFO] [14:42:39.897] Source encoding: UTF-8, default locale: en_GB
[INFO] [14:42:39.899] Sensor InitialOpenIssuesSensor...
[INFO] [14:42:39.920] Sensor InitialOpenIssuesSensor done: 21 ms
[INFO] [14:42:39.922] Sensor ProjectLinksSensor...
[INFO] [14:42:39.930] Sensor ProjectLinksSensor done: 8 ms
[INFO] [14:42:39.930] Sensor Maven dependencies...
[INFO] [14:42:39.931] Sensor Maven dependencies done: 1 ms
[INFO] [14:42:39.931] Sensor CPD Sensor (wrapped)...
[INFO] [14:42:39.931] Sensor CPD Sensor (wrapped) done: 0 ms
[INFO] [14:42:39.991] Execute decorators...
[INFO] [14:42:40.074] Export results to D:\openmrs-core\target\sonar\sonar-repor
t.json
[INFO] [14:42:40.271] Store results in database
[INFO] [14:42:40.385] ANALYSIS SUCCESSFUL
[INFO] [14:42:40.387] Executing post-job class org.sonar.issuesreport.ReportJob
[INFO] [14:42:40.865] Light HTML Issues Report generated: D:\openmrs-core\target
\sonar\issues-report\issues-report-light.html
[INFO] [14:42:40.960]

-------------  Issues Report  -------------

  No new issue

-------------------------------------------


[INFO] [14:42:40.962] Executing post-job class org.sonar.plugins.buildbreaker.Al
ertBreaker
[INFO] [14:42:40.963] Executing post-job class org.sonar.plugins.buildbreaker.Fo
rbiddenConfigurationBreaker
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OpenMRS ............................................ SUCCESS [01:22 min]
[INFO] openmrs-tools ...................................... SKIPPED
[INFO] openmrs-test ....................................... SKIPPED
[INFO] openmrs-api ........................................ SKIPPED
[INFO] openmrs-web ........................................ SKIPPED
[INFO] openmrs-webapp ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:25 min
[INFO] Finished at: 2017-10-19T14:42:41+02:00
[INFO] Final Memory: 34M/465M
[INFO] ------------------------------------------------------------------------

Any help appreciated, thank you.

A. Lindberg
  • 299
  • 4
  • 13
  • 1
    In the logs you can see it’s saying “0 files indexed”. So make sure your source and binary paths are correct. It should shows the count of indexed files. – Neero Oct 19 '17 at 14:12
  • Thank you, I edited some lines under the properties tag in openmrs' pom.xml file, like adding `target` and now it works! – A. Lindberg Oct 19 '17 at 15:15

2 Answers2

2

When you go through the logs its displaying

0 files indexed

This is happening because sonar unable to find the correct source paths and the particular binary paths(Which is compiled classes of given sources). So make sure those two paths are accurate. Then it will shows you the files count which is scanned by sonar as n files indexed.

Neero
  • 226
  • 2
  • 7
  • 23
0

From the log, I can see that you're using SonarQube 4.5.4 => this version is 2 years old !!! You should upgrade to SonarQube 5.6 latest LTS.