我正在尝试构建一个.Net项目并使用jenkins启动sonarqube代码分析。我做了以下步骤:
转到http://localhost:8080/configure并配置SonarQube服务器,如下所示:
转到http://localhost:8080/configureTools/并为MSBuild配置SonarQube扫描仪,如下所示:
SonarQube Scanner for MSBuild - Begin Analysis
和SonarQube Scanner for MSBuild - End Analysis
包装构建步骤:
我的问题: jenkings检查项目文件并成功构建项目但分析失败。
这是相关的控制台输出:
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
但我可以使用sonar-scanner-2.6.1对jenkings外的项目进行声纳分析,我在http://localhost:9000/上看到了结果
和
jenkins在没有分析步骤的情况下构建项目很好,所以我不明白SVN身份验证是如何成为问题的。凭证有效。
根据官方文档http://docs.sonarqube.org/display/SCAN/From+Jenkins,我必须配置
MSBuild SonarQube 亚军
但我只有一个名为
的部分用于MSBuild的SonarQube 扫描程序。
我错过了什么吗?跑步者和扫描仪之间的差异是什么?
答案 0 :(得分:3)
这里有几件不同的事情。
当您在Jenkins之外运行分析时,我猜测您将其作为已在该计算机上缓存SVN凭据的用户运行。因此,责备&#39;分析的一部分隐含地以你的身份运行。
当您在Jenkins中检查项目时,您明确地为作业提供凭据,并且明确使用作为该部分作业。
当您在Jenkins中运行分析时,当您在Jenkins之外运行分析时,该部分作业无法访问正在使用的缓存凭据。它也无法访问您为结帐提供Jenkins的凭据。代替。您需要进入SonarQube服务器并将这些凭证配置到项目中(您也可以将它们作为分析参数传递,但从长远来看,将它们添加到项目中可能更容易)。
要执行此操作,请导航至项目主页,然后管理&gt;一般设置&gt; SCM&gt; SVN ,并在那里填写您的凭证。