Sonar

编程入门 行业动态 更新时间:2024-10-12 22:33:56
Sonar-Runner不索引任何文件(Sonar-Runner doesn't index any files)

我正在尝试对我的playframework jave代码进行声纳分析。 没有索引的文件:

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: ------------------------------------------------------------------------

我使用jacoco进行代码覆盖。 我的声纳设置如下:

# 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

任何帮助表示赞赏。 谢谢!

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!

最满意答案

您必须从源目录的父目录中启动sonar-runner命令。 这不是这种情况,这就是为什么没有索引。

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.

更多推荐

本文发布于:2023-08-01 12:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1357656.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Sonar

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!