我们在几周内遇到了这个问题,SonarQube Complete Analysis VSTS任务在尝试分析ApplicationManifest.xml时失败了。
其他客户项目也出现类似问题,这仅适用于Azure Service Fabric项目。对于Service Fabric项目的ApplicationPackageRoot
和ApplicationParameters
文件夹下的所有XML,SonarQube分析失败。
为什么会失败,我们如何解决?
错误堆栈跟踪:
##[error]ERROR: Error during SonarQube Scanner execution
##[error]org.sonar.squidbridge.api.AnalysisException: Unable to analyse file D:/agenttst/_work/5/s/SFApp/SFApp/ApplicationPackageRoot/ApplicationManifest.xml
##[error]at org.sonar.plugins.xml.XmlSensor.processException(XmlSensor.java:195)
##[error]at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:158)
##[error]at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
##[error]at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:57)
##[error]at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:49)
##[error]at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:78)
##[error]at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:182)
##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
##[error]at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)
##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)
##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:240)
##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)
##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
##[error]at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
##[error]at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)
##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
##[error]at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)
##[error]at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:118)
##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)
##[error]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
##[error]at java.lang.reflect.Method.invoke(Unknown Source)
##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)
##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)
##[error]at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)
##[error]at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)
##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:77)
##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:61)
##[error]Caused by: java.lang.IllegalArgumentException: Unable to highlight file [moduleKey=SFProj_Test:SFProj_Test:EB984197-FA92-447D-95EC-6EFB5617045F, relative=ApplicationPackageRoot/ApplicationManifest.xml, basedir=D:\agenttst\_work\5\s\SFApp\SFApp]
##[error]at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:84)
##[error]at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:36)
##[error]at org.sonar.plugins.xml.XmlSensor.saveSyntaxHighlighting(XmlSensor.java:115)
##[error]at org.sonar.plugins.xml.XmlSensor.runChecks(XmlSensor.java:104)
##[error]at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:154)
##[error]... 31 more
##[error]Caused by: java.lang.IllegalArgumentException: 1454 is not a valid offset for file [moduleKey=SFProj_Test:SFProj_Test:EB984197-FA92-447D-95EC-6EFB5617045F, relative=ApplicationPackageRoot/ApplicationManifest.xml, basedir=D:\agenttst\_work\5\s\SFApp\SFApp]. Max offset is 1451
##[error]at org.sonar.api.internal.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
##[error]at org.sonar.api.batch.fs.internal.DefaultInputFile.newPointer(DefaultInputFile.java:268)
##[error]at org.sonar.api.batch.fs.internal.DefaultInputFile.newRange(DefaultInputFile.java:263)
##[error]at org.sonar.api.batch.sensor.highlighting.internal.DefaultHighlighting.highlight(DefaultHighlighting.java:82)
##[error]... 35 more
##[error]ERROR:
##[error]ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
##[error]The SonarQube Scanner did not complete successfully.
重现问题的步骤:
1.在Visual Studio中创建示例Azure Service结构项目
2.运行Service Fabric项目源的SonarQube分析步骤。
我们正在使用SonarQube 6.1和SonarXML 1.4.3.1027
如果您需要任何进一步的信息,请与我们联系。