如何将sonar-project.properties注入sonarqube中的msbuild

时间:2019-02-22 14:51:39

标签: msbuild sonarqube sonarqube-scan

我有一个C锐化解决方案(例如sample.sln),但是要运行声纳分析,根据文档,我已经运行了以下命令:

".\3rdparty\sonarqube\msbuild\SonarScanner.MSBuild.exe" begin /k:"comm" 
  /n:"comm" /v:"2.0" 
  /d:sonar.cs.dotcover.reportsPaths= 
  "D:\Jenkins\workspace\comm\TEST\CoverageReport.html" 
  /d:sonar.host.url="http://101.149.24.128"
  /d:sonar.sources="D:\Jenkins\workspace\comm\source\*.cs"

  msbuild comm.sln /t:Rebuild

  ".\3rdparty\sonarqube\msbuild\SonarScanner.MSBuild.exe" end

但出现此错误:

SONAR_SCANNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
INFO: Scanner configuration file: D:\Jenkins\workspace\comm\3rdparty\sonarqube\msbuild\sonar-scanner-3.2.0.1227\bin\..\conf\sonar-scanner.properties
INFO: Project root configuration file: D:\Jenkins\workspace\comm\.sonarqube\out\sonar-project.properties
INFO: SonarQube Scanner 3.2.0.1227
INFO: Java 1.8.0_151 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: SONAR_SCANNER_OPTS=-Xmx1024m
INFO: User cache: C:\Users\jenkins\.sonar\cache
INFO: SonarQube server 6.7.5
INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Publish mode
INFO: Load global settings
INFO: Load global settings (done) | time=278ms
INFO: Server id: 7950B4AD-AWYRoMpRpurWib7aM-qP
INFO: User cache: C:\Users\jenkins\.sonar\cache
INFO: Load plugins index
INFO: Load plugins index (done) | time=84ms
INFO: Process project properties
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 13.565s
INFO: Final Memory: 6M/84M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarQube Scanner execution
ERROR: Unable to load component class org.sonar.scanner.scan.ProjectLock
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.ProjectBuildersExecutor
ERROR: Caused by: Unable to load component class com.talanlabs.sonar.plugins.gitlab.CommitProjectBuilder
ERROR: Caused by: Unable to load component class com.talanlabs.sonar.plugins.gitlab.GitLabPluginConfiguration
ERROR: Caused by: Unable to load component class org.sonar.scanner.scan.MutableProjectSettings
ERROR: Caused by: Unable to load component class org.sonar.api.batch.bootstrap.ProjectReactor
**ERROR: Caused by: Illegal char <*> at index 43: D:\Jenkins\workspace\comm\source\*.cs**
ERROR: 
The SonarQube Scanner did not complete successfully

所以我想到了将所有与声纳相关的属性添加到sonar-project.properties中,并保留在项目根文件夹中,然后进行分析。但下面出现错误。

sonar-project.properties files are not understood by the SonarScanner for MSBuild. Remove those files from the following folders: D:\Jenkins\workspace\comm

have looked at this question

我可以从这篇文章中推断出什么,我们不能为msbuild设置sonar-project.properties吗?是吗 ?

那么,如何在声纳分析中从代码覆盖范围中包含/排除文件/文件夹?我没有管理员权限,无法设置管理全局排除项

有帮助吗?

使用声纳法LTS 6.7.6的P.S

0 个答案:

没有答案