SonarQube错误:“第一个字段没有定义资源模式”,即使没有设置排除?

时间:2017-07-26 10:06:50

标签: msbuild sonarqube sonar-runner sonarqube-scan

我正在努力将SonarQube与我们公司的项目集成,大部分项目都很好地集成而没有任何问题。

有一个项目一直处于失败状态(完成SonarQube分析)构建步骤,我怀疑这是原因:

org.sonar.api.utils.SonarException: Exclusions > Issues : Invalid format. The first field does not define a resource pattern: ,csharpsquid:S134,*

,csharpsquid:S134,*看起来像是由逗号分隔的3部分字符串,我不知道为什么第一部分丢失,因为我们没有为csharpsquid设置任何问题排除(来自网络或属性):S134。

启用/d:sonar.verbose=true也没有提供太多信息。 我们不希望csharpsquid:S134被排除,因为我们在csharpsquid上发现了一些违规:S134在其他项目中。

我们正在使用:

  • SonarQube服务器和扫描仪上的Java 8
  • SonarQube版本6.2
  • 用于MSBuild 3.0的SonarQube扫描仪
  • Sonar C#6.1.0.2359

另外,如果重要的话,我们刚刚从H2迁移到Azure sql server 2014?

完整堆栈跟踪:

2017-07-26T05:18:22.3083489Z ##[error]22:18:22.208 ERROR: Error during SonarQube Scanner execution

2017-07-26T05:18:22.3083489Z ##[error]java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.sensor.DefaultSensorStorage

2017-07-26T05:18:22.3093524Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)

2017-07-26T05:18:22.3093524Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)

2017-07-26T05:18:22.3093524Z ##[error]at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:272)

2017-07-26T05:18:22.3103529Z ##[error]at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)

2017-07-26T05:18:22.3103529Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)

2017-07-26T05:18:22.3113493Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)

2017-07-26T05:18:22.3113493Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:247)

2017-07-26T05:18:22.3113493Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:242)

2017-07-26T05:18:22.3123494Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:240)

2017-07-26T05:18:22.3123494Z ##[error]at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:232)

2017-07-26T05:18:22.3133537Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)

2017-07-26T05:18:22.3133537Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)

2017-07-26T05:18:22.3143546Z ##[error]at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:47)

2017-07-26T05:18:22.3143546Z ##[error]at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:86)

2017-07-26T05:18:22.3143546Z ##[error]at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142)

2017-07-26T05:18:22.3153539Z ##[error]at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)

2017-07-26T05:18:22.3153539Z ##[error]at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:115)

2017-07-26T05:18:22.3163510Z ##[error]at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:116)

2017-07-26T05:18:22.3163510Z ##[error]at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:63)

2017-07-26T05:18:22.3163510Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

2017-07-26T05:18:22.3173492Z ##[error]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

2017-07-26T05:18:22.3173492Z ##[error]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

2017-07-26T05:18:22.3183535Z ##[error]at java.lang.reflect.Method.invoke(Unknown Source)

2017-07-26T05:18:22.3183535Z ##[error]at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)

2017-07-26T05:18:22.3193555Z ##[error]at com.sun.proxy.$Proxy0.execute(Unknown Source)

2017-07-26T05:18:22.3193555Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:233)

2017-07-26T05:18:22.3193555Z ##[error]at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151)

2017-07-26T05:18:22.3203496Z ##[error]at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:123)

2017-07-26T05:18:22.3203496Z ##[error]at org.sonarsource.scanner.cli.Main.execute(Main.java:77)

2017-07-26T05:18:22.3203496Z ##[error]at org.sonarsource.scanner.cli.Main.main(Main.java:61)

2017-07-26T05:18:22.3213508Z ##[error]Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.issue.ModuleIssues

2017-07-26T05:18:22.3213508Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)

2017-07-26T05:18:22.3223544Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)

2017-07-26T05:18:22.3223544Z ##[error]at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)

2017-07-26T05:18:22.3223544Z ##[error]at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)

2017-07-26T05:18:22.3233556Z ##[error]at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)

2017-07-26T05:18:22.3233556Z ##[error]at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)

2017-07-26T05:18:22.3243504Z ##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)

2017-07-26T05:18:22.3243504Z ##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)

2017-07-26T05:18:22.3243504Z ##[error]at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)

2017-07-26T05:18:22.3253547Z ##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)

2017-07-26T05:18:22.3253547Z ##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)

2017-07-26T05:18:22.3263541Z ##[error]at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)

2017-07-26T05:18:22.3263541Z ##[error]at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)

2017-07-26T05:18:22.3263541Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)

2017-07-26T05:18:22.3273542Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)

2017-07-26T05:18:22.3273542Z ##[error]... 29 more

2017-07-26T05:18:22.3283505Z ##[error]Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.issue.IssueFilters

2017-07-26T05:18:22.3283505Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)

2017-07-26T05:18:22.3283505Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)

2017-07-26T05:18:22.3293560Z ##[error]at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)

2017-07-26T05:18:22.3293560Z ##[error]at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)

2017-07-26T05:18:22.3293560Z ##[error]at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)

2017-07-26T05:18:22.3303542Z ##[error]at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)

2017-07-26T05:18:22.3303542Z ##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)

2017-07-26T05:18:22.3303542Z ##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)

2017-07-26T05:18:22.3313551Z ##[error]at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)

2017-07-26T05:18:22.3313551Z ##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)

2017-07-26T05:18:22.3324709Z ##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)

2017-07-26T05:18:22.3324709Z ##[error]at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)

2017-07-26T05:18:22.3333606Z ##[error]at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)

2017-07-26T05:18:22.3333606Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)

2017-07-26T05:18:22.3333606Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)

2017-07-26T05:18:22.3343581Z ##[error]... 43 more

2017-07-26T05:18:22.3343581Z ##[error]Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.issue.ignore.IgnoreIssuesFilter

2017-07-26T05:18:22.3353529Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)

2017-07-26T05:18:22.3353529Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:621)

2017-07-26T05:18:22.3363526Z ##[error]at org.picocontainer.parameters.CollectionComponentParameter.getArrayInstance(CollectionComponentParameter.java:334)

2017-07-26T05:18:22.3363526Z ##[error]at org.picocontainer.parameters.CollectionComponentParameter.access$100(CollectionComponentParameter.java:49)

2017-07-26T05:18:22.3363526Z ##[error]at org.picocontainer.parameters.CollectionComponentParameter$1.resolveInstance(CollectionComponentParameter.java:139)

2017-07-26T05:18:22.3373528Z ##[error]at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:141)

2017-07-26T05:18:22.3373528Z ##[error]at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)

2017-07-26T05:18:22.3383536Z ##[error]at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)

2017-07-26T05:18:22.3383536Z ##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)

2017-07-26T05:18:22.3383536Z ##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)

2017-07-26T05:18:22.3393530Z ##[error]at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)

2017-07-26T05:18:22.3393530Z ##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)

2017-07-26T05:18:22.3403535Z ##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)

2017-07-26T05:18:22.3403535Z ##[error]at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)

2017-07-26T05:18:22.3403535Z ##[error]at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)

2017-07-26T05:18:22.3413601Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)

2017-07-26T05:18:22.3413601Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)

2017-07-26T05:18:22.3423537Z ##[error]... 57 more

2017-07-26T05:18:22.3423537Z ##[error]Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer

2017-07-26T05:18:22.3423537Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69)

2017-07-26T05:18:22.3433539Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)

2017-07-26T05:18:22.3433539Z ##[error]at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)

2017-07-26T05:18:22.3443544Z ##[error]at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)

2017-07-26T05:18:22.3443544Z ##[error]at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)

2017-07-26T05:18:22.3443544Z ##[error]at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)

2017-07-26T05:18:22.3453617Z ##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)

2017-07-26T05:18:22.3453617Z ##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)

2017-07-26T05:18:22.3463542Z ##[error]at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)

2017-07-26T05:18:22.3463542Z ##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)

2017-07-26T05:18:22.3463542Z ##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)

2017-07-26T05:18:22.3473524Z ##[error]at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)

2017-07-26T05:18:22.3473524Z ##[error]at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)

2017-07-26T05:18:22.3483533Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)

2017-07-26T05:18:22.3483533Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)

2017-07-26T05:18:22.3483533Z ##[error]... 73 more

2017-07-26T05:18:22.3493576Z ##[error]Caused by: org.sonar.api.utils.SonarException: Exclusions > Issues : Invalid format. The first field does not define a resource pattern: ,csharpsquid:S134,*

2017-07-26T05:18:22.3493576Z ##[error]at org.sonar.scanner.issue.ignore.pattern.PatternDecoder.checkRegularLineConstraints(PatternDecoder.java:78)

2017-07-26T05:18:22.3503528Z ##[error]at org.sonar.scanner.issue.ignore.pattern.AbstractPatternInitializer.initPatterns(AbstractPatternInitializer.java:73)

2017-07-26T05:18:22.3503528Z ##[error]at org.sonar.scanner.issue.ignore.pattern.AbstractPatternInitializer.<init>(AbstractPatternInitializer.java:41)

2017-07-26T05:18:22.3513586Z ##[error]at org.sonar.scanner.issue.ignore.pattern.IssueExclusionPatternInitializer.<init>(IssueExclusionPatternInitializer.java:39)

2017-07-26T05:18:22.3513586Z ##[error]at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

2017-07-26T05:18:22.3513586Z 22:18:22.213 DEBUG: Execution getVersion

2017-07-26T05:18:22.3523565Z 22:18:22.214 DEBUG: Execution stop

2017-07-26T05:18:22.3523565Z ##[error]at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

2017-07-26T05:18:22.3523565Z ##[error]at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

2017-07-26T05:18:22.3533573Z ##[error]at java.lang.reflect.Constructor.newInstance(Unknown Source)

2017-07-26T05:18:22.3533573Z ##[error]at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)

2017-07-26T05:18:22.3543563Z ##[error]at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)

2017-07-26T05:18:22.3543563Z ##[error]at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)

2017-07-26T05:18:22.3543563Z ##[error]at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)

2017-07-26T05:18:22.3563531Z ##[error]at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)

2017-07-26T05:18:22.3563531Z ##[error]at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)

2017-07-26T05:18:22.3573533Z ##[error]at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)

2017-07-26T05:18:22.3573533Z ##[error]at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)

2017-07-26T05:18:22.3573533Z ##[error]at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)

2017-07-26T05:18:22.3583572Z ##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:67)

2017-07-26T05:18:22.3583572Z ##[error]... 87 more

2017-07-26T05:18:22.3583572Z ##[error]22:18:22.213 ERROR:

2017-07-26T05:18:22.3593679Z ##[error]22:18:22.213 ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

任何帮助都是赞赏的。

1 个答案:

答案 0 :(得分:1)

某处您已定义了排除项。它不太可能在UI中定义。除了你已经看过那里之外,用户界面还会强制要求提供所有3个部分。

Places to look

  • 命令行参数 - 好吧,这个也不太可能,但为了彻底,这些是分析命令行上的额外/d:sonar.x=y
  • SonarQube.Analysis.xml - 此文件的路径将在/s:path的命令行上传递。它用于在项目之间共享参数值
  • .csproj文件 - 查找<SonarQubeSetting>元素

可以设置其他地方参数

    项目级UI中的
  • 管理&gt;一般设置&gt;分析范围
  • 全局级用户界面中的
  • 管理&gt;分析范围