Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonar-Runner doesn't index any files

I'm trying to run a sonar analysis on my playframework jave code. There are no files indexed:

me@fhnw:/home/mycomp/myReporting/sonar-runner/java-sonar-runner-simple$ /home/me/tmp/sonar-runner-2.4/bin/sonar-runner 
SonarQube Runner 2.4
Java 1.7.0_55 Oracle Corporation (64-bit)
Linux 3.5.0-49-generic amd64
INFO: Runner configuration file: /home/me/tmp/sonar-runner-2.4/conf/sonar-runner.properties
INFO: Project configuration file: /home/mycomp/myReporting/sonar-runner/java-sonar-runner-simple/sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: /home/mycomp/myReporting/sonar-runner/java-sonar-runner-simple/./.sonar
INFO: SonarQube Server 4.2
16:15:45.869 INFO  - Load batch settings
16:15:46.002 INFO  - User cache: /home/me/.sonar/cache
16:15:46.009 INFO  - Install plugins
16:15:46.120 INFO  - Install JDBC driver
16:15:46.127 WARN  - H2 database should be used for evaluation purpose only
16:15:46.127 INFO  - Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
16:15:47.170 INFO  - Initializing Hibernate
16:15:48.391 WARN  - /!\ The 'tests' property is deprecated and is replaced by 'sonar.tests'. Don't forget to update your files.
16:15:48.391 WARN  - /!\ The 'binaries' property is deprecated and is replaced by 'sonar.binaries'. Don't forget to update your files.
16:15:48.954 INFO  - Load project settings
16:15:49.003 INFO  - Apply project exclusions
16:15:49.148 INFO  - -------------  Scan My project
16:15:49.152 INFO  - Load module settings
16:15:49.719 INFO  - Language is forced to java
16:15:49.739 INFO  - Loading technical debt model...
16:15:50.109 INFO  - Loading technical debt model done: 370 ms
16:15:50.120 INFO  - Configure Maven plugins
16:15:50.303 INFO  - Compare to previous analysis (2014-05-09)
16:15:50.328 INFO  - Compare over 30 days (2014-04-09, analysis of 2014-05-07 13:39:57.555)
16:15:50.480 INFO  - Base dir: /home/mycomp/myReporting/sonar-runner/java-sonar-runner-simple/.
16:15:50.480 INFO  - Working dir: /home/mycomp/myReporting/sonar-runner/java-sonar-runner-simple/./.sonar
16:15:50.480 INFO  - Source dirs: /home/mycomp/myReporting/app
16:15:50.480 INFO  - Test dirs: /home/mycomp/myReporting/test
16:15:50.480 INFO  - Binary dirs: /home/mycomp/myReporting/target/scala-2.10/classes
16:15:50.480 INFO  - Source encoding: UTF-8, default locale: en_US
16:15:50.480 INFO  - Index files
16:15:50.516 WARN  - File '%s' is ignored. It is not located in module basedir '%s'.
...
16:15:50.539 WARN  - File '%s' is ignored. It is not located in module basedir '%s'.
16:15:50.539 INFO  - 0 files indexed
16:15:50.541 INFO  - Quality profile for java: Sonar way
16:15:50.549 INFO  - Sensor Quality gate loader...
16:15:50.550 INFO  - Sensor Quality gate loader done: 1 ms
16:15:50.550 INFO  - Sensor QProfileSensor...
16:15:50.555 INFO  - Sensor QProfileSensor done: 5 ms
16:15:50.556 INFO  - Sensor CpdSensor...
16:15:50.556 INFO  - SonarEngine is used for java
16:15:50.556 INFO  - Sensor CpdSensor done: 0 ms
16:15:50.556 INFO  - Sensor InitialOpenIssuesSensor...
16:15:50.565 INFO  - Sensor InitialOpenIssuesSensor done: 9 ms
16:15:50.565 INFO  - Sensor ProfileEventsSensor...
16:15:50.590 INFO  - Sensor ProfileEventsSensor done: 25 ms
16:15:50.590 INFO  - Sensor ProjectLinksSensor...
16:15:50.595 INFO  - Sensor ProjectLinksSensor done: 5 ms
16:15:50.595 INFO  - Sensor VersionEventsSensor...
16:15:50.605 INFO  - Sensor VersionEventsSensor done: 10 ms
16:15:50.606 INFO  - Sensor FileHashSensor...
16:15:50.606 INFO  - Sensor FileHashSensor done: 0 ms
16:15:51.086 INFO  - Execute decorators...
16:15:51.272 INFO  - Store results in database
16:15:51.321 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/my:project
16:15:51.376 INFO  - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
16:15:51.377 INFO  - Executing post-job class org.sonar.plugins.core.batch.IndexProjectPostJob
16:15:51.398 INFO  - Executing post-job class org.sonar.plugins.dbcleaner.ProjectPurgePostJob
16:15:51.414 INFO  - -> Keep one snapshot per day between 2014-04-11 and 2014-05-08
16:15:51.415 INFO  - -> Keep one snapshot per week between 2013-05-10 and 2014-04-11
16:15:51.416 INFO  - -> Keep one snapshot per month between 2009-05-15 and 2013-05-10
16:15:51.417 INFO  - -> Delete data prior to: 2009-05-15
16:15:51.424 INFO  - -> Clean My project [id=2]
16:15:51.428 INFO  - <- Clean snapshot 9
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
Total time: 6.309s
Final Memory: 14M/498M
INFO: ------------------------------------------------------------------------

I'm using jacoco for code coverage. My sonar settings look like this:

# Required metadata
sonar.projectKey=my:project
sonar.projectName=My project
sonar.projectVersion=1.0

# Language
sonar.language=java

# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional. If not set, SonarQube starts looking for source code
# from the directory containing the sonar-project.properties file.
sonar.sources=/home/mycomp/myReporting/app/
tests=/home/mycomp/myReporting/test/
binaries=/home/mycomp/myReporting/target/scala-2.10/classes

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# Additional parameters
sonar.dynamicAnalysis=reuseReports
sonar.java.coveragePlugin=jacoco
sonar.jacoco.reportPath=/home/mycomp/myReporting/target/coverage/jacoco.exec

Any help is appreciated. Thanks!

like image 459
myborobudur Avatar asked May 09 '14 14:05

myborobudur


People also ask

What is sonar Inclusions?

sonar.inclusions. Comma-delimited list of file path patterns to be included in analysis. When set, only files matching the paths set here will be included in analysis. sonar.exclusions. Comma-delimited list of file path patterns to be excluded from analysis.

How do I run a sonar runner from command prompt?

open a command prompt, and go to project root folder. execute “sonar-runner” command to run the analysis. you would see the analysis run. you would find your project listed under “projects”.

How to ignore issues in SonarQube?

You can have SonarQube ignore issues on certain components and against certain coding rules. Go to Administration > General Settings > Analysis Scope > Issues. Note that the properties below can only be set through the web interface because they are multi-valued.


1 Answers

You must launch the sonar-runner command from a directory which is a parent of the source directory. This is not the case here and that's why nothing is indexed.

like image 92
Freddy - SonarSource Team Avatar answered Oct 14 '22 11:10

Freddy - SonarSource Team