jenkins的MS build和SonarQube分析,无法执行Sonar,E170001 [英] MS build and SonarQube analysis from jenkins, unable to execute Sonar, E170001

查看:200
本文介绍了jenkins的MS build和SonarQube分析,无法执行Sonar,E170001的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个.Net项目,并使用jenkins开始sonarqube代码分析.我执行了以下步骤:

I'm trying to build a .Net project and start the sonarqube code analysis with jenkins. I did the following steps:

  1. 下载SonarQube
  2. 启动SonarQube服务器:C:... \ sonarqube \ bin \ windows-x86-64 \ StartSonar.bat
  3. 在Jenkins上安装SonarQube 2.4.4插件
  4. 转到 http://localhost:8080/configure 并配置SonarQube服务器,如图所示这里:

  1. Download SonarQube
  2. Start the SonarQube server: C:...\sonarqube\bin\windows-x86-64\StartSonar.bat
  3. Install SonarQube 2.4.4 Plugin on Jenkins
  4. Go to http://localhost:8080/configure and configure the SonarQube server as shown here:

转到 http://localhost:8080/configureTools/并将SonarQube Scanner配置为这样的MSBuild:

Go to http://localhost:8080/configureTools/ and configure SonarQube Scanner for MSBuild like this:

  1. 在jenkins中添加了一个作业,将项目配置为使用MS build构建,并用SonarQube Scanner for MSBuild - Begin AnalysisSonarQube Scanner for MSBuild - End Analysis包裹了构建步骤:
  1. Added a job in jenkins, configured the project to be build with MS build, wrapped the build step with SonarQube Scanner for MSBuild - Begin Analysis and SonarQube Scanner for MSBuild - End Analysis:

我的问题:抽空检出项目文件并成功构建项目,但分析失败.

My Problem: jenkings checking out the project files and building the project successfully but the analysis fails.

这是相关的控制台输出:

here is the relevant console output:

10:53:36.189 INFO  - 113 files to be analyzed
10:53:36.805 INFO  - 0/113 files analyzed
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 17.443s
Final Memory: 18M/404M
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)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
    at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
    at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
    at org.sonar.runner.api.Runner.execute(Runner.java:100)
    at org.sonar.runner.Main.executeTask(Main.java:70)
    at org.sonar.runner.Main.execute(Main.java:59)
    at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: Error when executing blame for file App_Start/BundleConfig.cs
    at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:102)
    at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:59)
    at org.sonar.batch.scm.ScmSensor.execute(ScmSensor.java:86)
    at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
    at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
    at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:234)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
    at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
    at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
    at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
    at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more
Caused by: org.tmatesoft.svn.core.SVNAuthenticationException: svn: E170001: Authentication required for '<https://subversion.xyz:443> 
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:47)
    at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.authenticationFailed(SVNErrorManager.java:41)
    at org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager.getFirstAuthentication(DefaultSVNAuthenticationManager.java:203)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:716)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:398)
    at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:386)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.performHttpRequest(DAVConnection.java:863)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.exchangeCapabilities(DAVConnection.java:699)
    at org.tmatesoft.svn.core.internal.io.dav.DAVConnection.open(DAVConnection.java:118)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.openConnection(DAVRepository.java:1049)
    at org.tmatesoft.svn.core.internal.io.dav.DAVRepository.hasCapability(DAVRepository.java:877)
    at org.tmatesoft.svn.core.io.SVNRepository.assertServerIsMergeInfoCapable(SVNRepository.java:787)
    at org.tmatesoft.svn.core.io.SVNRepository.getFileRevisions(SVNRepository.java:756)
    at org.tmatesoft.svn.core.internal.wc16.SVNLogClient16.doAnnotate(SVNLogClient16.java:1389)
    at org.tmatesoft.svn.core.internal.wc16.SVNLogClient16.doAnnotate(SVNLogClient16.java:291)
    at org.tmatesoft.svn.core.internal.wc2.old.SvnOldAnnotate.run(SvnOldAnnotate.java:45)
    at org.tmatesoft.svn.core.internal.wc2.old.SvnOldAnnotate.run(SvnOldAnnotate.java:17)
    at org.tmatesoft.svn.core.internal.wc2.SvnOperationRunner.run(SvnOperationRunner.java:21)
    at org.tmatesoft.svn.core.wc2.SvnOperationFactory.run(SvnOperationFactory.java:1235)
    at org.tmatesoft.svn.core.wc2.SvnOperation.run(SvnOperation.java:294)
    at org.tmatesoft.svn.core.wc.SVNLogClient.doAnnotate(SVNLogClient.java:295)
    at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:100)
    ... 37 more
ERROR: 
ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging.
The SonarQube Scanner did not complete successfully
10:53:37.058  Creating a summary markdown file...
Post-processing failed. Exit code: 1
ERROR: Execution of SonarQube Scanner for MSBuild failed (exit code 1)
Finished: FAILURE

错误提示:

由以下原因引起:org.tmatesoft.svn.core.SVNAuthenticationException

Caused by: org.tmatesoft.svn.core.SVNAuthenticationException

但是我可以使用sonar-scanner-2.6.1在jenkings之外的项目上进行声纳分析,并且我在 http://localhost:9000/

But I'm able to run sonarqube analysis on the project outside jenkings with sonar-scanner-2.6.1 and I see the results on http://localhost:9000/

AND

jenkins在没有分析步骤的情况下可以很好地构建项目,因此我不理解SVN身份验证可能是个问题.凭据有效.

jenkins builds fine the project without the analysis step, so I don't understand how SVN authentication could be the problem. The Credentials are valid.

根据官方文档 http://docs.sonarqube.org/display/SCAN/From + Jenkins 我必须配置

According to the official documentation http://docs.sonarqube.org/display/SCAN/From+Jenkins I have to configure a

MSBuild SonarQube 亚军

但是我只有一个名为

用于MSBuild的SonarQube 扫描仪.

我错过了什么吗?转轮和扫描仪之间的区别是什么?

Have I missed something? What is the diffrance between runner and scanner?

推荐答案

这里发生了几种不同的事情.

There are several different things going on here.

当您在Jenkins外部运行分析时,我会猜测您是以在该计算机上缓存了SVN凭据的用户身份运行该分析的.因此,分析的非议事"部分会像您一样隐式运行.

When you run analysis outside Jenkins I'm going to guess that you run it as a user that has cached SVN credentials on that machine. So the 'blame' portion of the analysis implicitly runs as you.

当您在Jenkins中签出项目时,您显式地为工作提供了凭据,并且这些凭据被显式地用于工作的那部分..

When you check the project out in Jenkins, you explicitly provide credentials to the job, and those credentials are explicitly used for that portion of the job.

在Jenkins中运行分析时,当您在Jenkins外部运行分析时,该部分作业无法访问正在使用的缓存凭据.它也无权访问您提供的Jenkins结帐凭证.反而.您需要进入SonarQube服务器并将这些凭据配置到项目中(您也可以将它们作为分析参数传递,但是从长远来看,将它们添加到项目中可能会更容易).

When you run analysis in Jenkins, that portion of the job has no access to the cached credentials in use when you run analysis outside of Jenkins. Nor does it have access to the credentials you supplied Jenkins for the checkout. Instead. you'll need to go into your SonarQube server and configure those credentials into the project (you could also pass them as analysis parameters, but it's probably easier in the long run to add them to the project).

要执行此操作,请导航至项目主页,然后依次单击管理">常规设置">"SCM">"SVN" ,然后在其中填写您的凭据.

To do this, navigate to the project home page, then Administration > General Settings > SCM > SVN, and fill in your credentials there.

这篇关于jenkins的MS build和SonarQube分析,无法执行Sonar,E170001的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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