sonar.sources存在错误,我该如何解决?

时间:2019-03-16 17:01:37

标签: sonarqube

我得到的是这个错误...我是sonarqube的新手。.我不知道该如何解决....我也尝试过添加src作为源。但这不起作用...

Microsoft Windows [Version 10.0.17134.648]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\____>cd C:\Users\_____\Desktop\ITPM_SonarqubeSampleProject

C:\Users\____\Desktop\ITPM_SonarqubeSampleProject>sonar-scanner
INFO: Scanner configuration file: C:\sonarScanner\sonar-scanner-3.3.0.1492- 
windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 3.3.0.1492
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Windows 10 10.0 amd64
INFO: User cache: C:\Users\_____\.sonar\cache
INFO: SonarQube server 7.6.0
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Load global settings
INFO: Load global settings (done) | time=126ms
INFO: Server id: BF41A1F2-AWmFD6wOR7iN1xXjam-4
INFO: User cache: C:\Users\_____\.sonar\cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=84ms
INFO: Load/download plugins (done) | time=225ms
INFO: Process project properties
ERROR: Invalid value of sonar.sources for ITMP_SonarqubeSampleProject
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 3.105s
INFO: Final Memory: 6M/162M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: The folder 'ITMP_SonarqubeSampleProject/src' does not exist for 'ITMP_SonarqubeSampleProject' (base directory = C:\Users\____\Desktop\ITPM_SonarqubeSampleProject)
ERROR:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

C:\Users\_____\Desktop\ITPM_SonarqubeSampleProject>

我添加到sonar-scanner.properties中的内容。

 sonar.projectKey = ITMP_SonarqubeSampleProject
 sonar.projectName = ITMP_SonarqubeSampleProject
 sonar.projectVersion = 1.0
 sonar.sources = c:/ITMP_SonarqubeSampleProject/src/itpm_sonarqubesampleproject

1 个答案:

答案 0 :(得分:0)

首先,不清楚为什么要进入C:\Users\____\Desktop\ITPM_SonarqubeSampleProject目录并将sonar.sources定义为c:/ITMP_SonarqubeSampleProject/src/itpm_sonarqubesampleproject

第二,下面的最后一行指示当前文件夹中没有sonar-scanner.properties

INFO: Scanner configuration file: C:\sonarScanner\sonar-scanner-3.3.0.1492- 
windows\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: NONE

我建议您将此文件添加到项目中,并在其上设置这些属性(而不是在声纳扫描仪安装的sonar-scanner.properties上)。

之后,如果您在运行声纳扫描仪时位于C:\Users\____\Desktop\ITPM_SonarqubeSampleProject目录中,并考虑到您的源代码在其中,则只需设置sonar.sources=.。您不需要使用绝对路径。