MSBuild的SonarQube亚军在命令行 [英] MSBuild SonarQube runner in command line

查看:443
本文介绍了MSBuild的SonarQube亚军在命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,分析使用的MSBuild SonarQube亚军的​​项目。 SonarQube数据库和服务器的正常运行,我试图分析一个示例项目,它一切顺利。但是,当我试图分析我的项目出了问题。分析完成,没有错误,但没有分析数据保存到数据库中,没有任何问题,没有台词的code计数,什么都没有。

任何人有什么地方出错了?任何想法

编辑:

sonar-project.properties:

  sonar.projectKey =爆炸蘑菇
sonar.projectName =爆炸蘑菇
sonar.projectVersion = 1.0
sonar.sources =。
 

sonar.properties:

  sonar.jdbc.username =用户
sonar.jdbc.password =通
sonar.jdbc.url = JDBC:JTDS:SQLSERVER://本地主机,数据库名= SonarQubeDB; SelectMethod =游标
sonar.web.host = 0.0.0.0
sonar.web.context = / sonarqube
sonar.web.port = 9000
 

SonarQube.Analysis.xml:

 < SonarQubeAnalysisProperties的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance的xmlns:XSD =htt​​p://www.w3.org / 2001 / XML模式的xmlns =http://www.sonarsource.com/msbuild/integration/2015/1>

  <属性名=sonar.host.url>的http://本地主机:9000 / sonarqube< /性>


  <属性名=sonar.login>管理< /性>
  <属性名=sonar.password>管理< /性>


  &LT;物业Name="sonar.jdbc.url">jdbc:jtds:sqlserver://localhost;databaseName=SonarQubeDB;SelectMethod=Cursor</Property>
  &LT;属性名=sonar.jdbc.username&GT;数据库用户名和LT; /性&gt;
  &LT;属性名=sonar.jdbc.password&GT; DBPASSWORD&LT; /性&gt;

&LT; / SonarQubeAnalysisProperties&GT;
 

在服务器日志孤单只有一个新行增加我运行分析之后:

  

二零一五年七月三十日17点02分29秒INFO网站[osscComputationService]项目爆炸蘑菇分析报告(4)(完成)|时间= 18179ms

最后行MSBuild.SonarRunner日志:

 下午五时零一分18秒17:01:18.906信息 - 执行装饰...
下午5点01分十九秒17:01:19.969信息 - 商店的结果数据库
下午5时○二分05秒17:02:05.266信息 - 迪尔大小9578ms生成分析报告,= 82 KB
下午5点○二分08秒17:02:08.922信息 - 分析报告COM pressed在3656ms,压缩大小= 285 KB
下午五时02分10秒17:02:10.704信息 - 在1782ms发送到服务器分析报告
下午五时02分10秒17:02:10.704信息 - 成功的分析,您可以浏览HTTP://本地主机:9000 / sonarqube
/仪表板/索引/爆炸蘑菇
下午五时02分10秒17:02:10.704信息 - 请注意,您将能够访问更新的仪表盘,一旦
 服务器已经处理了提交分析报告。
下午5点02分十四秒INFO:------------------------------------------ ------------------------------
下午5点02分十四秒INFO:执行成功
下午5点02分十四秒INFO:------------------------------------------ ------------------------------
下午5点02分十四秒的总时间:8:10.724s
下午5点02分十四秒最终内存:14M / 310M
下午5点02分十四秒INFO:------------------------------------------ ------------------------------
下午五时零二分15秒处理返回的退出code 0
下午5点02分一十五秒声纳亚军已完成
下午五时零二分15秒创建汇总降价文件...
下午五时零二分15秒结果分析:HTTP://本地主机:9000 / sonarqube /仪表板/索引/爆炸蘑菇
流程返回的退出code 0
后处理成功。
 

解决方案

感谢您的更多信息。

首先,你不再需要一个 sonar-project.properties 文件来分析项目的MSBuild的SonarQube亚军:从您的项目中删除它

您可能要分析一个项目,其完整路径包含测试。这导致该项目作为一个测试项的检测,并且将它们渲染为测试SonarQube(你在看仪表盘上的实际来源,即不包括测试数据)。

请删除测试从项目的路径,或更新用于检测试验项目的常规EX pression SonarQube属性: sonar.cs .msbuild.testProjectPattern

仅供参考 - 这项测试检测机制将在即将发布的版本是试图从含测试是一个相当普遍的情况下一个文件夹中的MSBuild SonarQube亚军更新:的 http://jira.sonarsource.com/browse/SONARMSBRU-121

I have a problem analyzing a project using MSBuild SonarQube runner. SonarQube database and server are up and running, i have tried to analyze an example project and it all went well. But when i try to analyze my project something goes wrong. The analysis completes with no errors but no analysis data is saved to database, no issues, no lines of code count, nothing.

Anyone has any idea of what could be wrong?

EDIT:

sonar-project.properties:

sonar.projectKey=shrooms
sonar.projectName=Shrooms
sonar.projectVersion=1.0
sonar.sources=.

sonar.properties:

sonar.jdbc.username=user
sonar.jdbc.password=pass
sonar.jdbc.url=jdbc:jtds:sqlserver://localhost;databaseName=SonarQubeDB;SelectMethod=Cursor
sonar.web.host=0.0.0.0
sonar.web.context=/sonarqube
sonar.web.port=9000

SonarQube.Analysis.xml:

<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">

  <Property Name="sonar.host.url">http://localhost:9000/sonarqube</Property>


  <Property Name="sonar.login">admin</Property>
  <Property Name="sonar.password">admin</Property>


  <Property Name="sonar.jdbc.url">jdbc:jtds:sqlserver://localhost;databaseName=SonarQubeDB;SelectMethod=Cursor</Property>
  <Property Name="sonar.jdbc.username">dbusername</Property>
  <Property Name="sonar.jdbc.password">dbpassword</Property>

</SonarQubeAnalysisProperties>

In server log theres only one new line added after i run the analysis:

2015.07.30 17:02:29 INFO web[o.s.s.c.ComputationService] Analysis of project shrooms (report 4) (done) | time=18179ms

Last lines of the MSBuild.SonarRunner log:

5:01:18 PM  17:01:18.906 INFO  - Execute decorators...
5:01:19 PM  17:01:19.969 INFO  - Store results in database
5:02:05 PM  17:02:05.266 INFO  - Analysis reports generated in 9578ms, dir size=82 KB
5:02:08 PM  17:02:08.922 INFO  - Analysis reports compressed in 3656ms, zip size=285 KB
5:02:10 PM  17:02:10.704 INFO  - Analysis reports sent to server in 1782ms
5:02:10 PM  17:02:10.704 INFO  - ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/sonarqube
/dashboard/index/shrooms
5:02:10 PM  17:02:10.704 INFO  - Note that you will be able to access the updated dashboard once the
 server has processed the submitted analysis report.
5:02:14 PM  INFO: ------------------------------------------------------------------------
5:02:14 PM  INFO: EXECUTION SUCCESS
5:02:14 PM  INFO: ------------------------------------------------------------------------
5:02:14 PM  Total time: 8:10.724s
5:02:14 PM  Final Memory: 14M/310M
5:02:14 PM  INFO: ------------------------------------------------------------------------
5:02:15 PM  Process returned exit code 0
5:02:15 PM  The sonar-runner has finished
5:02:15 PM  Creating a summary markdown file...
5:02:15 PM  Analysis results: http://localhost:9000/sonarqube/dashboard/index/shrooms
Process returned exit code 0
Post-processing succeeded.

解决方案

Thanks for the additional information.

First of all, you no longer need a sonar-project.properties file to analyze projects with the MSBuild SonarQube Runner: Remove it from your project.

You probably are trying to analyze a project whose full path contains test. This leads to the detection of the project as a test one, and will render them as test in SonarQube (all the metrics you see in the dashboard are on actual sources, i.e. excluding tests).

Either remove test from the project path, or update the regular expression SonarQube property used to detect test projects: sonar.cs.msbuild.testProjectPattern

FYI - this test detection mechanism will be updated in an upcoming release as trying out the MSBuild SonarQube Runner from a folder containing test is quite a common scenario: http://jira.sonarsource.com/browse/SONARMSBRU-121

这篇关于MSBuild的SonarQube亚军在命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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