SonarQube:分析C#和VB项目时出错

时间:2016-01-07 20:57:35

标签: sonarqube-msbuild-runner

我正在尝试按照此处的说明尝试SonarQube for MSBuild: http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+MSBuild,但我对C#和VB样本有以下错误。我在sonar.log中找不到任何消息所以不知道如何继续。

C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>where msbuild
C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe


C:\Tools\SonarQube\sonar-examples-master\projects\languages\csharp>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: Duplicate project GUID: "12add147-fbaf-46aa-b8a4-f708d4d0f295". Check that the project is only being built for a single platform/co
nfiguration and that that the project guid is unique. The project will not be analyzed by SonarQube. Project file: C:\Tools\SonarQube\sonar-
examples-master\projects\languages\csharp\ConsoleApplication1\ConsoleApplication1.csproj

C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet>MSBuild.SonarQube.Runner.exe end
SonarQube Scanner for MSBuild 1.1
Default properties file was found at C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Loading analysis properties from C:\Tools\SonarQube\MSBuild.SonarQube.Runner-1.1\SonarQube.Analysis.xml
Post-processing started.
SonarQube Scanner for MSBuild End Step 1.1
WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\huj\AppData\Local\Temp\.NETFr
amework,Version=v4.5.AssemblyAttributes.vb, project: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1\C
onsoleApplication1.vbproj
SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m
Calling the SonarQube Scanner...
C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..
SonarQube Runner 2.4
Java 1.8.0_60 Oracle Corporation (64-bit)
Windows 7 6.1 amd64
SONAR_RUNNER_OPTS=-Xmx1024m
INFO: Error stacktraces are turned on.
INFO: Runner configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\bin\sonar-runner\bin\..\conf\s
onar-runner.properties
INFO: Project configuration file: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\sonar-project.properties
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Work directory: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar
INFO: SonarQube Server 5.2
15:43:49.634 INFO  - Load global repositories
15:43:49.815 INFO  - Load global repositories (done) | time=180ms
15:43:49.830 INFO  - User cache: C:\Users\huj\.sonar\cache
15:43:50.224 INFO  - Load plugins index
15:43:50.227 INFO  - Load plugins index (done) | time=3ms
15:43:50.458 INFO  - Process project properties
15:43:50.728 INFO  - Load project repositories
15:43:50.741 INFO  - Load project repositories (done) | time=13ms
15:43:50.747 INFO  - Apply project exclusions
15:43:50.871 INFO  - Load quality profiles
15:43:50.919 INFO  - Load quality profiles (done) | time=48ms
15:43:50.924 INFO  - Load active rules
15:43:51.344 INFO  - Load active rules (done) | time=420ms
15:43:51.362 WARN  - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to def
ine SCM of your project.
15:43:51.362 INFO  - Publish mode
15:43:51.363 INFO  - -------------  Scan ConsoleApplication1
15:43:51.459 INFO  - Load server rules
15:43:51.629 INFO  - Load server rules (done) | time=170ms
15:43:51.684 INFO  - Base dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\ConsoleApplication1
15:43:51.684 INFO  - Working dir: C:\Tools\SonarQube\sonar-examples-master\projects\languages\vbnet\.sonarqube\out\.sonar\vbnet_vbnet_65E63A
B4-1055-4104-B233-A9F7CF2233DA
15:43:51.685 INFO  - Source paths: Module1.vb, My Project/AssemblyInfo.vb, My Project/Resources.resx, My Project/Application.myapp, My Proje
ct/Settings.settings, App.config
15:43:51.685 INFO  - Source encoding: UTF-8, default locale: en_US
15:43:51.686 INFO  - Index files
15:43:51.709 INFO  - 2 files indexed
15:43:51.711 INFO  - Quality profile for vbnet: Sonar way
15:43:51.885 INFO  - All FxCop rules are disabled, skipping its execution.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 3.142s
Final Memory: 11M/308M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)

1 个答案:

答案 0 :(得分:1)

由于警告:重复项目GUID ... ,您的C#项目未被分析。检查您的项目指南是否唯一。如果您运行开始步骤,然后在调用 end 之前多次为同一项目调用MSBuild,您也会收到此错误。尝试运行开始,MSBuild .... 结束,看看是否能修复C#项目问题。对于VB问题,请从Java错误中包含更多的调用堆栈。