无法使用SonarQube(sonar.scanner)分析XML文件



我是Sonarqube的新手,这是我第一次尝试通过Sonar扫描仪分析一个informatica XML。 我已经创建了项目,并在其中提供了一个小规则(通过提供 XPATH 查询(。

在示例工具中尝试 XPATH 查询时工作正常。 但是,在Sonarqube中,当运行声纳扫描仪时,它会给出以下错误:

在运行以下命令时收到的错误下面提供:

C:sonar-scanner-3.0.3.778-windowsbin>sonar-scanner -X

错误

   Error during SonarQube Scanner execution
    org.sonar.squidbridge.api.AnalysisException: 
    Unable to analyse file C:/sonar-scanner-3.0.3.778-windows/bin/s_m_GW_FDR_SOI_ST_SPCIF_PL.XML

注意:如果我错过了什么,很抱歉,因为我是新手。

13:12:57.798 INFO: Scanner configuration file: C:sonar-scanner-3.0.3.778-windowsbin..confsonar-scanner.properties
13:12:57.809 INFO: Project root configuration file: NONE
13:12:57.830 INFO: SonarQube Scanner 3.0.3.778
13:12:57.832 INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
13:12:57.834 INFO: Windows 10 10.0 amd64
13:12:57.991 DEBUG: keyStore is :
13:12:57.993 DEBUG: keyStore type is : jks
13:12:57.999 DEBUG: keyStore provider is :
13:12:58.001 DEBUG: init keystore
13:12:58.012 DEBUG: init keymanager of type SunX509
13:12:58.264 INFO: User cache: C:Usersp.das.purkayastha.sonarcache
13:12:58.267 DEBUG: Extract sonar-scanner-api-batch in temp...
13:12:58.285 DEBUG: Get bootstrap index...
13:12:58.285 DEBUG: Download: http://localhost:9000/batch/index
13:12:58.355 DEBUG: Get bootstrap completed
13:12:58.355 DEBUG: Create isolated classloader...
13:12:58.374 DEBUG: Start temp cleaning...
13:12:58.389 DEBUG: Temp cleaning done
13:12:58.391 DEBUG: Execution getVersion
13:12:58.406 DEBUG: Execution start
13:12:58.675 DEBUG: Publish global mode
13:12:58.791 INFO: Load global settings
13:12:58.845 DEBUG: GET 200 http://localhost:9000/api/settings/values.protobuf | time=43ms
13:12:58.866 INFO: Load global settings (done) | time=76ms
13:12:58.880 INFO: User cache: C:Usersp.das.purkayastha.sonarcache
13:12:59.126 INFO: Load plugins index
13:12:59.157 DEBUG: GET 200 http://localhost:9000/deploy/plugins/index.txt | time=14ms
13:12:59.164 INFO: Load plugins index (done) | time=38ms
13:12:59.168 DEBUG: Load plugins
13:12:59.199 DEBUG: Load plugins (done) | time=31ms
13:12:59.221 DEBUG: API compatibility mode is enabled on plugin Git [scmgit] (built with API lower than 5.2)
13:12:59.226 DEBUG: API compatibility mode is enabled on plugin SVN [scmsvn] (built with API lower than 5.2)
13:12:59.363 DEBUG: Plugins:
13:12:59.364 DEBUG:   * C# 5.10.1.1411 (csharp)
13:12:59.365 DEBUG:   * Python 1.7.0.1195 (python)
13:12:59.365 DEBUG:   * SonarJava 4.9.0.9858 (java)
13:12:59.384 DEBUG:   * Flex 2.3 (flex)
13:12:59.386 DEBUG:   * Git 1.2 (scmgit)
13:12:59.386 DEBUG:   * SonarXML 1.4.2.885 (xml)
13:12:59.386 DEBUG:   * SonarPHP 2.10.0.2087 (php)
13:12:59.411 DEBUG:   * SVN 1.4.0.522 (scmsvn)
13:12:59.413 DEBUG:   * SonarJS 3.0.0.4962 (javascript)
13:12:59.442 DEBUG: Execution getVersion
13:12:59.445 INFO: SonarQube server 6.4.0
13:12:59.446 INFO: Default locale: "en_US", source code encoding: "windows-1252" (analysis is platform dependent)
13:12:59.446 DEBUG: Work directory: C:sonar-scanner-3.0.3.778-windowsbin.scannerwork
13:12:59.470 DEBUG: Execution getVersion
13:12:59.472 DEBUG: Execution execute
13:12:59.805 INFO: Process project properties
13:12:59.806 DEBUG: Process project properties (done) | time=1ms
13:12:59.934 INFO: Load project repositories
13:12:59.965 DEBUG: GET 200 http://localhost:9000/batch/project.protobuf?key=xml%3ATesting_INFA_XMLs_Folder_Name | time=27ms
13:13:00.016 INFO: Load project repositories (done) | time=82ms
13:13:00.123 DEBUG: Available languages:
13:13:00.126 DEBUG:   * C# => "cs"
13:13:00.133 DEBUG:   * Python => "py"
13:13:00.136 DEBUG:   * Java => "java"
13:13:00.148 DEBUG:   * Flex => "flex"
13:13:00.151 DEBUG:   * XML => "xml"
13:13:00.161 DEBUG:   * PHP => "php"
13:13:00.166 DEBUG:   * JavaScript => "js"
13:13:00.189 INFO: Load quality profiles
13:13:00.230 DEBUG: GET 200 http://localhost:9000/api/qualityprofiles/search.protobuf?projectKey=xml%3ATesting_INFA_XMLs_Folder_Name | time=36ms
13:13:00.238 INFO: Load quality profiles (done) | time=49ms
13:13:00.250 INFO: Load active rules
13:13:00.366 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-V5wdA6ze3S2GhG&p=1&ps=500 | time=115ms
13:13:00.645 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-cwwdA6ze3S2Gjn&p=1&ps=500 | time=215ms
13:13:00.753 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-kLwdA6ze3S2Gn3&p=1&ps=500 | time=63ms
13:13:00.799 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzwAeH1wdA6ze3S2Gt1&p=1&ps=500 | time=30ms
13:13:00.877 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-tUwdA6ze3S2Gs0&p=1&ps=500 | time=68ms
13:13:00.956 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-m6wdA6ze3S2GpZ&p=1&ps=500 | time=60ms
13:13:01.031 DEBUG: GET 200 http://localhost:9000/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives,createdAt&activation=true&qprofile=AVzv5-l0wdA6ze3S2Go2&p=1&ps=500 | time=49ms
13:13:01.063 INFO: Load active rules (done) | time=813ms
13:13:01.066 INFO: Load metrics repository
13:13:01.086 DEBUG: GET 200 http://localhost:9000/api/metrics/search?f=name,description,direction,qualitative,custom&ps=500&p=1 | time=18ms
13:13:01.144 INFO: Load metrics repository (done) | time=78ms
13:13:01.181 WARN: SCM provider autodetection failed. No SCM provider claims to support this project. Please use sonar.scm.provider to define SCM of your project.
13:13:01.186 INFO: Publish mode
13:13:01.186 INFO: Project key: xml:Testing_INFA_XMLs_Folder_Name
13:13:01.186 DEBUG: Start recursive analysis of project modules
13:13:01.211 INFO: -------------  Scan INFA_XML_VAL
13:13:01.339 INFO: Load server rules
13:13:01.496 DEBUG: GET 200 http://localhost:9000/api/rules/list.protobuf | time=156ms
13:13:01.516 INFO: Load server rules (done) | time=177ms
13:13:01.618 DEBUG: Declared extensions of language C# were converted to sonar.lang.patterns.cs : **/*.cs
13:13:01.624 DEBUG: Declared extensions of language Python were converted to sonar.lang.patterns.py : **/*.py
13:13:01.632 DEBUG: Declared extensions of language Java were converted to sonar.lang.patterns.java : **/*.java,**/*.jav
13:13:01.641 DEBUG: Declared extensions of language Flex were converted to sonar.lang.patterns.flex : **/*.as
13:13:01.649 DEBUG: Declared extensions of language XML were converted to sonar.lang.patterns.xml : **/*.xml,**/*.xsd,**/*.xsl
13:13:01.664 DEBUG: Declared extensions of language PHP were converted to sonar.lang.patterns.php : **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
13:13:01.674 DEBUG: Declared extensions of language JavaScript were converted to sonar.lang.patterns.js : **/*.js
13:13:01.761 DEBUG: Initializers : GenericCoverageSensor
13:13:01.764 INFO: Initializer GenericCoverageSensor
13:13:01.766 INFO: Initializer GenericCoverageSensor (done) | time=2ms
13:13:01.779 INFO: Base dir: C:sonar-scanner-3.0.3.778-windowsbin
13:13:01.783 INFO: Working dir: C:sonar-scanner-3.0.3.778-windowsbin.scannerwork
13:13:01.793 INFO: Source paths: .
13:13:01.798 INFO: Source encoding: windows-1252, default locale: en_US
13:13:01.808 INFO: Index files
13:13:01.835 DEBUG: 'sonar-scanner-debug.bat' indexed with language 'null'
13:13:01.838 DEBUG: 's_m_GW_FDR_SOI_ST_SPCIF_PL.XML' indexed with language 'xml'
13:13:01.837 DEBUG: 'sonar-scanner.bat' indexed with language 'null'
13:13:01.847 DEBUG: 's_m_REF_TFADDTNL_RES_TYPE_LOAD.XML' indexed with language 'xml'
13:13:01.862 INFO: 4 files indexed
13:13:01.873 INFO: Quality profile for xml: Testing INFA XMLs
13:13:02.651 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
13:13:02.654 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
13:13:02.667 DEBUG: 'C#' skipped because there is no related file in current project
13:13:02.671 DEBUG: 'C# Unit Tests Coverage Report Import' skipped because there is no related file in current project
13:13:02.680 DEBUG: 'C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
13:13:02.690 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
13:13:02.695 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
13:13:02.713 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
13:13:02.716 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
13:13:02.716 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
13:13:02.735 DEBUG: 'Flex' skipped because there is no related file in current project
13:13:02.746 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
13:13:02.746 DEBUG: 'PHP sensor' skipped because there is no related file in current project
13:13:02.762 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
13:13:02.773 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
13:13:02.779 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
13:13:02.784 DEBUG: 'C#' skipped because there is no related file in current project
13:13:02.789 DEBUG: 'C# Unit Tests Coverage Report Import' skipped because there is no related file in current project
13:13:02.802 DEBUG: 'C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
13:13:02.807 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
13:13:02.820 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
13:13:02.823 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
13:13:02.837 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
13:13:02.841 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
13:13:02.855 DEBUG: 'Flex' skipped because there is no related file in current project
13:13:02.856 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
13:13:02.872 DEBUG: 'PHP sensor' skipped because there is no related file in current project
13:13:02.878 DEBUG: 'JavaScript Squid Sensor' skipped because there is no related file in current project
13:13:02.895 DEBUG: Sensors : SonarJavaXmlFileSensor -> XML Sensor -> Analyzer for "php.ini" files -> Zero Coverage Sensor -> CPD Block Indexer
13:13:02.902 INFO: Sensor SonarJavaXmlFileSensor [java]
13:13:02.904 INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=2ms
13:13:02.917 INFO: Sensor XML Sensor [xml]
13:13:03.096 DEBUG: 's_m_GW_FDR_SOI_ST_SPCIF_PL.XML' generated metadata  with charset 'windows-1252'
13:13:03.141 DEBUG: Count lines in C:/sonar-scanner-3.0.3.778-windows/bin/s_m_GW_FDR_SOI_ST_SPCIF_PL.XML
13:13:04.304 INFO: ------------------------------------------------------------------------
13:13:04.307 INFO: EXECUTION FAILURE
13:13:04.308 INFO: ------------------------------------------------------------------------
13:13:04.322 INFO: Total time: 6.565s
13:13:04.474 INFO: Final Memory: 47M/361M
13:13:04.476 INFO: ------------------------------------------------------------------------
13:13:04.485 ERROR: Error during SonarQube Scanner execution
org.sonar.squidbridge.api.AnalysisException: Unable to analyse file C:/sonar-scanner-3.0.3.778-windows/bin/s_m_GW_FDR_SOI_ST_SPCIF_PL.XML
        at org.sonar.plugins.xml.XmlSensor.processException(XmlSensor.java:193)
        at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:156)
        at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
        at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:87)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:81)
        at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:67)
        at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:75)
        at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:259)
        at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:254)
        at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:243)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)
        at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:144)
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:129)
        at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:118)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:117)
        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: java.lang.NullPointerException
        at org.sonar.plugins.xml.XmlSensor.saveIssue(XmlSensor.java:126)
        at org.sonar.plugins.xml.XmlSensor.runChecks(XmlSensor.java:102)
        at org.sonar.plugins.xml.XmlSensor.execute(XmlSensor.java:152)
        ... 31 more
13:13:04.805 DEBUG: Execution getVersion
13:13:04.818 DEBUG: Execution stop

这是一个已知问题,将在即将推出的SonarXML(1.4.3(版本中修复。

最新更新