新的Msbuild Sonar运行程序正在跳过对.net项目的分析 [英] New Msbuild Sonar runner is skipping analysis for .net projects

查看:197
本文介绍了新的Msbuild Sonar运行程序正在跳过对.net项目的分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为项目类型类库"设置了新的Msbuild声纳运行程序和启动分析.它成功了.为了进一步测试,

I have setup new Msbuild sonar runner and kickoff analysis for a project type "class library". It went successful. To test it further,

  1. 我创建了另一个项目,该项目只有一个文件具有5个接口定义.
  2. 我确保接口名称不是以字母"i"开头.
  3. 我使用一个stylecop规则创建了质量配置文件,即接口名称必须以i开头".
  4. 我启动了cmd提示符(VS命令提示符),并将其路径更改为具有.csproj文件的目录.显然,我不在.sln文件级别.恰好再向下一层可以看到.csproj文件.
  5. 解雇开始-msbuild-结束序列.
  6. 它显示"Analysis SUCCESSFUL",但是当我在仪表板上没有看到任何问题时(问题0,在我看来是5,而每个问题都是针对一个界面的.)
  7. 仔细观察Log后,显示以下消息.我不确定我是否完全理解.

警告:文件不在项目目录下,并且SonarQube当前无法对其进行分析.文件:C:\ Users \ raja.moparthi \ AppData \ Local \ Temp.NETFramework,Version = v4.5.AssemblyAttributes.cs,项目:D:\ SonarQube-Test-Projects \ Fibanocci \ TestFib2 \ TestFib2.csproj

WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\raja.moparthi\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\TestFib2.csproj

请让我知道这里出了什么问题.

Please let me know what is going wrong here.

开始命令日志如下:

Default properties file was found at D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml

Loading analysis properties from D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml

Pre-processing started.

Using environment variables to determine the download directory...

Removing the existing directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube

Creating directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube

Creating directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin

SonarQube server url: http://{SonarQube ServerName: I removed it}:9000/

Downloading SonarQube.MSBuild.Runner.Implementation.zip from http://{SonarQube ServerName: I removed it}/static/csharp/SonarQube.MSBuild.Runner.Implementation.zip to D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\SonarQube.MSBuild.Runner.Implementation.zip






Executing file D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\MSBuild.SonarQube.Internal.PreProcess.exe

  Args: "/k:FibTest" "/n:FibTestAnalysis" "/v:1.0.0.0" "/s:D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml"


  Working directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube


  Timeout (ms):-1


  Process id: 4692


10:51:21 PM  Loading analysis properties from D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml


10:51:21 PM  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\raja.moparthi\AppData\Local\Microsoft\MSBuild\14.0\Microsoft.Common.targets\ImportBefore

10:51:21 PM  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\raja.moparthi\AppData\Local\Microsoft\MSBuild\12.0\Microsoft.Common.targets\ImportBefore

10:51:21 PM  The file SonarQube.Integration.ImportBefore.targets is up to date at C:\Users\raja.moparthi\AppData\Local\Microsoft\MSBuild\4.0\Microsoft.Common.targets\ImportBefore


10:51:21 PM  Not running under TeamBuild

10:51:21 PM  Analysis base directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube

Build directory: 
Bin directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin


Config directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf

Output directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out


Config file: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out

10:51:21 PM  Creating config and output folders...

10:51:21 PM  Creating directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf

10:51:21 PM  Creating directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out

10:51:21 PM  Generating the FxCop ruleset: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf\SonarQubeFxCop-cs.ruleset


10:51:22 PM  Generating the FxCop ruleset: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf\SonarQubeFxCop-vbnet.ruleset


10:51:22 PM  Saving the config file to D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf\SonarQubeAnalysisConfig.xml


Process returned exit code 0


Pre-processing succeeded.

----------------
Msbuild command log is given below.

Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.34209]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 9/8/2015 10:51:36 PM.

Project "D:\SonarQube-Test-Projects\Fibanocci\TestFib2\TestFib2.csproj" on node 1 (default targets).


GenerateTargetFrameworkMonikerAttribute:

Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.

CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.

_CopyAppConfigFile:
Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.


CopyFilesToOutputDirectory:
  TestFib2 -> D:\SonarQube-Test-Projects\Fibanocci\TestFib2\bin\Debug\TestFib2.exe


OverrideCodeAnalysisProperties:
  Skipping FxCop analysis: the SonarQube ruleset does not exist. Ruleset: D:\SonarQube-Test-Projects\Fibanocci


\TestFib2\.sonarqube\conf\\SonarQubeFxCop-cs.ruleset
  Skipping FxCop analysis: the project is a test project

SetStyleCopAnalysisSettings:
  Setting 'sonar.stylecop.projectFilePath' to 'D:\SonarQube-Test-Projects\Fibanocci\TestFib2\TestFib2.csproj'


WriteSonarQubeProjectData:
  Directory "D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\\TestFib2__AnyCPU_Debug_635773494965392474" doesn't exist. Skipping.


  Creating directory "D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\\TestFib2__AnyCPU_Debug_635773494965392474".

Done Building Project "D:\SonarQube-Test-Projects\Fibanocci\TestFib2\TestFib2.csproj" (default targets).

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.32
End

----------------
End command log is given below.

Default properties file was found at D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml

Loading analysis properties from D:\MsBuildSonarQubeRunner\SonarQube.Analysis.xml

Post-processing started.

Using environment variables to determine the download directory...

Executing file D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\MSBuild.SonarQube.Internal.PostProcess.exe

  Args: 
  Working directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube
  Timeout (ms):-1
  Process id: 8528

10:51:54 PM  Not running under TeamBuild

10:51:54 PM  Analysis base directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube

Build directory: 

Bin directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin

Config directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf

Output directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out

Config file: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out

10:51:54 PM  Loading the SonarQube analysis config from D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\conf\SonarQubeAnalysisConfig.xml

10:51:54 PM  Generating SonarQube project properties file to D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\sonar-project.properties

10:51:54 PM  WARNING: File is not under the project directory and cannot currently be analysed by SonarQube. File: C:\Users\raja.moparthi\AppData\Local\Temp\.NETFramework,Version=v4.5.AssemblyAttributes.cs, project: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\TestFib2.csproj


10:51:54 PM  Writing processing summary to D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\ProjectInfo.log

10:51:54 PM  Creating directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\sonar-runner

10:51:54 PM  The SONAR_RUNNER_HOME environment variable is not required and will be ignored.

10:51:54 PM  Calling the sonar-runner...

10:51:54 PM  SONAR_RUNNER_OPTS is not configured. Setting it to the default value of -Xmx1024m

10:51:54 PM  Setting environment variable 'SONAR_RUNNER_OPTS'. Value: -Xmx1024m

10:51:54 PM  Executing file D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\sonar-runner\bin\sonar-runner.bat


  Args: -Dproject.settings="D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\sonar-project.properties"

  Working directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\sonar-runner\bin
  Timeout (ms):-1
  Process id: 11196


10:51:54 PM  D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\sonar-runner\bin\..

10:51:54 PM  SonarQube Runner 2.4

10:51:54 PM  Java 1.8.0_60 Oracle Corporation (64-bit)

10:51:54 PM  Windows 7 6.1 amd64

10:51:54 PM  SONAR_RUNNER_OPTS=-Xmx1024m

10:51:54 PM  INFO: Runner configuration file: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties

10:51:54 PM  INFO: Project configuration file: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\sonar-project.properties

10:51:54 PM  INFO: Default locale: "en_US", source code encoding: "UTF-8"

10:51:54 PM  INFO: Work directory: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\.sonar

10:51:55 PM  INFO: SonarQube Server 5.0.1

10:51:56 PM  22:51:56.238 INFO  - Load global referentials...

10:51:57 PM  22:51:57.049 INFO  - Load global referentials done: 813 ms

10:51:57 PM  22:51:57.055 INFO  - User cache: C:\Users\raja.moparthi\.sonar\cache

10:51:57 PM  22:51:57.065 INFO  - Install plugins

10:51:57 PM  22:51:57.390 INFO  - Install JDBC driver

10:51:57 PM  22:51:57.600 INFO  - Create JDBC datasource for jdbc:jtds:sqlserver://{DB server- I removed original server name for security purpose}/sonar;SelectMethod=Cursor


10:52:04 PM  22:52:04.530 INFO  - Initializing Hibernate

10:52:07 PM  22:52:07.162 INFO  - Load project referentials...

10:52:10 PM  22:52:10.353 INFO  - Load project referentials done: 3191 ms

10:52:10 PM  22:52:10.354 INFO  - Load project settings

10:52:10 PM  22:52:10.884 INFO  - Loading technical debt model...

10:52:11 PM  22:52:11.930 INFO  - Loading technical debt model done: 1046 ms

10:52:11 PM  22:52:11.936 INFO  - Apply project exclusions

10:52:20 PM  22:52:20.949 WARN  - SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.


10:52:20 PM  22:52:20.951 INFO  - -------------  Scan TestFib2

10:52:20 PM  22:52:20.955 INFO  - Load module settings

10:52:57 PM  22:52:57.308 INFO  - Loading rules...

10:53:07 PM  22:53:07.904 INFO  - Loading rules done: 10596 ms

10:53:08 PM  22:53:08.100 INFO  - Configure Maven plugins

10:53:10 PM  22:53:10.219 INFO  - Compare to previous analysis (2015-09-08)

10:53:10 PM  22:53:10.439 INFO  - Compare over 30 days (2015-08-09, analysis of 2015-09-08 21:09:01.457)

10:53:10 PM  22:53:10.441 INFO  - No quality gate is configured.

10:53:10 PM  22:53:10.513 INFO  - Base dir: D:\SonarQube-Test-Projects\Fibanocci\TestFib2

10:53:10 PM  22:53:10.514 INFO  - Working dir: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\.sonar\FibTest_FibTest_B51D1FBF-8925-45C4-B8C8-5DBE2F60DBCE


10:53:10 PM  22:53:10.518 INFO  - Test paths: Program.cs, Properties/AssemblyInfo.cs, App.config


10:53:10 PM  22:53:10.519 INFO  - Source encoding: UTF-8, default locale: en_US

10:53:10 PM  22:53:10.519 INFO  - Index files

10:53:10 PM  22:53:10.576 INFO  - 2 files indexed

10:53:15 PM  22:53:15.923 INFO  - Quality profile for cs: Mks Test Rules

10:53:15 PM  22:53:15.949 INFO  - Sensor QProfileSensor...

10:53:15 PM  22:53:15.961 INFO  - Sensor QProfileSensor done: 12 ms

10:53:15 PM  22:53:15.961 INFO  - Sensor InitialOpenIssuesSensor...

10:53:17 PM  22:53:17.547 INFO  - Sensor InitialOpenIssuesSensor done: 1586 ms

10:53:17 PM  22:53:17.548 INFO  - Sensor ProjectLinksSensor...

10:53:18 PM  22:53:18.541 INFO  - Sensor ProjectLinksSensor done: 993 ms

10:53:19 PM  22:53:19.130 INFO  - Sensor VersionEventsSensor...

10:53:21 PM  22:53:21.896 INFO  - Sensor VersionEventsSensor done: 2766 ms

10:53:21 PM  22:53:21.896 INFO  - Sensor FileHashSensor...

10:53:21 PM  22:53:21.904 INFO  - Sensor FileHashSensor done: 8 ms

10:53:21 PM  22:53:21.904 INFO  - Sensor SCM Sensor...

10:53:21 PM  22:53:21.904 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.

10:53:21 PM  22:53:21.904 INFO  - Sensor SCM Sensor done: 0 ms

10:53:21 PM  22:53:21.904 INFO  - Sensor CPD Sensor...

10:53:21 PM  22:53:21.905 INFO  - DefaultCpdEngine is used for cs

10:53:21 PM  22:53:21.906 INFO  - Sensor CPD Sensor done: 2 ms

10:53:22 PM  22:53:22.118 INFO  - Execute decorators...

10:53:28 PM  22:53:28.033 INFO  - -------------  Scan FibTestAnalysis

10:53:28 PM  22:53:28.039 INFO  - Load module settings

10:53:28 PM  22:53:28.086 INFO  - Configure Maven plugins

10:53:28 PM  22:53:28.291 INFO  - Compare to previous analysis (2015-09-08)

10:53:28 PM  22:53:28.491 INFO  - Compare over 30 days (2015-08-09, analysis of 2015-09-08 21:09:01.457)

10:53:28 PM  22:53:28.493 INFO  - No quality gate is configured.

10:53:28 PM  22:53:28.518 INFO  - Base dir: D:\SonarQube-Test-Projects\Fibanocci\TestFib2

10:53:28 PM  22:53:28.518 INFO  - Working dir: D:\SonarQube-Test-Projects\Fibanocci\TestFib2\.sonarqube\out\.sonar

10:53:28 PM  22:53:28.518 INFO  - Source encoding: UTF-8, default locale: en_US

10:53:29 PM  22:53:29.121 INFO  - Sensor InitialOpenIssuesSensor...

10:53:30 PM  22:53:30.301 INFO  - Sensor InitialOpenIssuesSensor done: 1180 ms

10:53:30 PM  22:53:30.302 INFO  - Sensor ProjectLinksSensor...

10:53:30 PM  22:53:30.893 INFO  - Sensor ProjectLinksSensor done: 591 ms

10:53:31 PM  22:53:31.483 INFO  - Sensor VersionEventsSensor...

10:53:33 PM  22:53:33.659 INFO  - Sensor VersionEventsSensor done: 2176 ms

10:53:33 PM  22:53:33.659 INFO  - Sensor FileHashSensor...

10:53:33 PM  22:53:33.660 INFO  - Sensor FileHashSensor done: 1 ms

10:53:33 PM  22:53:33.660 INFO  - Sensor SCM Sensor...

10:53:33 PM  22:53:33.660 INFO  - No SCM system was detected. You can use the 'sonar.scm.provider' property to explicitly specify it.

10:53:33 PM  22:53:33.660 INFO  - Sensor SCM Sensor done: 0 ms

10:53:33 PM  22:53:33.660 INFO  - Sensor CPD Sensor...
10:53:33 PM  22:53:33.660 INFO  - Sensor CPD Sensor done: 0 ms
10:53:33 PM  22:53:33.774 INFO  - Execute decorators...
10:53:37 PM  22:53:37.356 INFO  - Store results in database
10:53:42 PM  22:53:42.464 INFO  - ANALYSIS SUCCESSFUL, you can browse http://{ server- I removed original server name for security purpose}:9000/dashboard/index/FibTest
10:53:42 PM  22:53:42.464 INFO  - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
10:53:42 PM  22:53:42.465 INFO  - Executing post-job class org.sonar.plugins.core.issue.notification.SendIssueNotificationsPostJob
10:53:44 PM  INFO: ------------------------------------------------------------------------
10:53:44 PM  INFO: EXECUTION SUCCESS
10:53:44 PM  INFO: ------------------------------------------------------------------------
10:53:44 PM  Total time: 1:49.413s
10:53:44 PM  Final Memory: 14M/457M
10:53:44 PM  INFO: ------------------------------------------------------------------------
10:53:44 PM  Process returned exit code 0
10:53:44 PM  The sonar-runner has finished
10:53:44 PM  Creating a summary markdown file...
10:53:44 PM  Analysis results: http://{ server- I removed original server name for security purpose}:9000/dashboard/index/FibTest
Process returned exit code 0
Post-processing succeeded.

推荐答案

感谢您在问题中提供所有这些有价值的细节,从而使回答变得更加容易.

Thanks for providing all these valuable details in your questions, which makes it easier to answer.

首先,您可以放心地忽略C:\Users\raja.moparthi\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.cs消息:该文件不属于您的项目,也不需要进行分析.

First of all, you can safely ignore the message C:\Users\raja.moparthi\AppData\Local\Temp.NETFramework,Version=v4.5.AssemblyAttributes.cs : That file does not belong to your project, and does not have to be analyzed.

然后,我认为您正面临MSBuild SonarQube Runner 1.0版本的限制,该版本已在即将发布的1.0.1版本中修复:如果您的.csproj文件的完整路径包含test,该项目将被检测为测试项目,SonarQube不会报告测试项目的问题.有关详细信息,请参见此票证: https://jira.sonarsource.com/browse/SONARMSBRU-121在等待这个新版本时,最简单的操作就是从文件夹名称中删除test.

Then, I think that you are facing a limitation of the MSBuild SonarQube Runner 1.0 release, which is already fixed in the soon to be released 1.0.1 version: If the full path to your .csproj file contains test, the project will be detected as a test one, and SonarQube doesn't report issues on tests projects. See this tickets for details: https://jira.sonarsource.com/browse/SONARMSBRU-121 While waiting on this new release, the easiest thing you can do is simply to remove test from the folder names.

这篇关于新的Msbuild Sonar运行程序正在跳过对.net项目的分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆