【问题标题】:SonarQube: No analysis retrievedSonarQube:未检索到分析
【发布时间】:2020-06-15 17:44:41
【问题描述】:

我试图运行一个项目。

执行成功,但似乎没有任何分析。

命令提示符的日志如下:

C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin>sonar-scanner.bat
C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\..
INFO: Scanner configuration file: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-sca
nner-2.6.1\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_102 Oracle Corporation (64-bit)
INFO: Windows 7 6.1 amd64
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load global repositories
INFO: Load global repositories (done) | time=167ms
WARN: Property 'sonar.jdbc.url' is not supported any more. It will be ignored. T
here is no longer any DB connection to the SQ database.
INFO: User cache: C:\Users\kong-yong.tay\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=11ms
INFO: SonarQube server 5.6
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Process project properties
INFO: Load project repositories
INFO: Load project repositories (done) | time=173ms
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=87ms
INFO: Load active rules
INFO: Load active rules (done) | time=569ms
WARN: SCM provider autodetection failed. No SCM provider claims to support this
project. Please use sonar.scm.provider to define SCM of your project.
INFO: Publish mode
INFO: -------------  Scan Javascript Sonar Runner Simple
INFO: Language is forced to js
INFO: Load server rules
INFO: Load server rules (done) | time=325ms
INFO: Base dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin
INFO: Working dir: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\
.sonar
INFO: Source paths: C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\p
rojects\languages\javascript\javascript-sonar-runner\src
INFO: Source encoding: UTF-8, default locale: en_US
INFO: Index files
WARN: File 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\
languages\javascript\javascript-sonar-runner\src\Person.js' is ignored. It is no
t located in module basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-
2.6.1\bin'.
INFO: 0 files indexed
INFO: Quality profile for js: Sonar way
INFO: JaCoCoSensor: JaCoCo report not found : C:\Users\kong-yong.tay\Desktop\Son
ar\sonar-scanner-2.6.1\bin\target\jacoco.exec
INFO: JaCoCoItSensor: JaCoCo IT report not found: C:\Users\kong-yong.tay\Desktop
\Sonar\sonar-scanner-2.6.1\bin\target\jacoco-it.exec
INFO: Sensor Lines Sensor
INFO: Sensor Lines Sensor (done) | time=0ms
INFO: Sensor SCM Sensor
INFO: No SCM system was detected. You can use the 'sonar.scm.provider' property
to explicitly specify it.
INFO: Sensor SCM Sensor (done) | time=2ms
INFO: Sensor Zero Coverage Sensor
INFO: Sensor Zero Coverage Sensor (done) | time=0ms
INFO: Sensor Code Colorizer Sensor
INFO: Sensor Code Colorizer Sensor (done) | time=0ms
INFO: Sensor CPD Block Indexer
INFO: DefaultCpdBlockIndexer is used for js
INFO: Sensor CPD Block Indexer (done) | time=1ms
INFO: Calculating CPD for 0 files
INFO: CPD calculation finished
INFO: Analysis report generated in 72ms, dir size=11 KB
INFO: Analysis reports compressed in 14ms, zip size=4 KB
INFO: Analysis report uploaded in 86ms
INFO: ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/
org.sonarqube:java-simple-sq-scanner
INFO: Note that you will be able to access the updated dashboard once the server
 has processed the submitted analysis report
INFO: More about the report processing at http://localhost:9000/api/ce/task?id=A
VZ3vdRUAtopFvSq_-I1
INFO: ------------------------------------------------------------------------
INFO: EXECUTION SUCCESS
INFO: ------------------------------------------------------------------------
INFO: Total time: 4.071s
INFO: Final Memory: 47M/180M
INFO: ------------------------------------------------------------------------

第一次运行(虽然没有任何分析结果但在数据库中记录了一个日志)。但是,在我随后运行测试时,它已经停止了与数据库的连接。

请帮忙。

【问题讨论】:

    标签: sonarqube sonarqube-scan


    【解决方案1】:

    您应该在项目所在的目录中运行SonarQube Scanner,而不是从存储扫描仪的位置。简而言之(在你的情况下):

    > cd C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner
    > C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\sonar-scanner.bat
    

    现状

    目前您从以下位置运行它:

    信息:工作目录:C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner-2.6.1\bin\

    但是你的代码在:

    INFO:源路径:C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\languages\javascript\javascript-sonar-runner\src

    由于您没有明确设置sonar.projectBaseDir(请参阅Analysis Parameters),您最终会收到以下警告:

    警告:文件 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-examples-master\projects\ 语言\javascript\javascript-sonar-runner\src\Person.js' 被忽略。它不是 t 位于模块 basedir 'C:\Users\kong-yong.tay\Desktop\Sonar\sonar-scanner- 2.6.1\bin'。

    信息:0 个文件已编入索引

    【讨论】:

    • 嗨 Nicholas,我已经设法获得了分析结果。谢谢。但是,似乎日志没有记录在数据库中。我第一次运行被记录,但随后的运行没有记录在数据库表 dbo.projects 中。你知道为什么会这样吗?我尝试在网上寻找解决方案,但它似乎不起作用。 [链接]stackoverflow.com/questions/35230453/…
    • @KongYong :查看Background Tasks 看是否有错误。如果它解决了您的问题,也可以使用accept this answer。
    • @NicolasB.-SonarSourceTeam,根据你我也设置了我的 projectBaseDir。但是如果我的项目位于第一个文件夹内的 d:\sample\ 是源文件,另一个是 sonar-project.properties 文件。我还把 sonar-scanner 文件夹和这个源放在了一起。但我仍然收到此错误。
    • @VjyV :对于初学者,不要使用projectBaseDir,只需将sonar-project.properties 放在项目的根目录下,然后从同一位置运行sonar-scanner
    • @NicolasB.-SonarSourceTeam ,是的,我已经做了同样的事情,但它仍然忽略了 js 文件
    猜你喜欢
    • 1970-01-01
    • 2016-09-13
    • 2019-01-07
    • 2021-03-09
    • 1970-01-01
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    • 2015-11-28
    相关资源
    最近更新 更多