使用sonar-scanner扫描代码时,报错如下:
ERROR: Error during SonarQube Scanner execution java.lang.IllegalStateException: Error when executing blame for file bqjr_afs_public/src/main/java/com/billionsfinance/afs/common/CisConstants.java at org.sonar.plugins.scm.svn.SvnBlameCommand.blame(SvnBlameCommand.java:86) 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:1at 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.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.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60) at com.sun.proxy.$Proxy0.execute(Unknown Source) at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123) at org.sonarsource.scanner.cli.Main.execute(Main.java:77) at org.sonarsource.scanner.cli.Main.main(Main.java:61) Caused by: org.tmatesoft.svn.core.SVNException: svn: E175002: Connection has been shutdown: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name svn: E175002: OPTIONS request failed on '/svn/OperationSupport/AFS/branches/AFS_20180322/AFS_20180322/bqjr_afs_public/src/main/java/com/billionsfinance/afs/common/CisConstants.java' at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:106) at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:90) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:798) 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:84) ... 32 more Caused by: javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name at sun.security.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1551) at sun.security.ssl.SSLSocketImpl.checkWrite(SSLSocketImpl.java:1563) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:71) at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.sendData(HTTPConnection.java:340) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPRequest.dispatch(HTTPRequest.java:170) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:497) ... 50 more Caused by: javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name at sun.security.ssl.ClientHandshaker.handshakeAlert(ClientHandshaker.java:1446) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2026) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1135) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413) at sun.security.ssl.SSLSocketImpl.getSession(SSLSocketImpl.java:2301) at org.tmatesoft.svn.core.internal.io.dav.http.HTTPConnection.request(HTTPConnection.java:490) ... 50 more ERROR: ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging. ERROR: SonarQube scanner exited with non-zero code: 1 Finished: FAILURE
分析原因应该是sonar扫描的代码中有中文字符导致,打开sonarqube的控制台,使用admin登录后 ,在配置->SCM->菜单中,将Disabled the SCM Sensor设置为true,或者在svn页面,设置svn的用户名和密码。