SonarQube 4.3目前在我正在构建的NodeJS项目的JavaScript预览分析期间失败。排除它抱怨的文件只是将错误移动到同一路径下的另一个.js文件。
我在完整分析模式下没有任何问题。这是一个错误/已知问题吗?
带有-e和-X选项的Sonar Runner输出:
19:27:34.274 INFO - Execute decorators...
19:27:34.274 DEBUG - Decorators: ManualMeasureDecorator -> org.sonar.issuesreport.tree.ResourceTree@46f9fe8e -> SumDuplicationsDecorator -> UnitTestDecorator -> org.sonar.plugins.core.sensors.DirectoriesDecorator@4f8c7e32 -> org.sonar.plugins.core.sensors.FilesDecorator@10b12d6b -> org.sonar.plugins.core.timemachine.TimeMachineConfigurationPersister@64f247a7 -> org.sonar.plugins.core.timemachine.NewCoverageAggregator@601cd45c -> org.sonar.plugins.uselesscodetracker.decorator.TempMethodLinesDecorator@4ba1550 -> org.sonar.plugins.uselesscodetracker.decorator.DuplicationsDecorator@6d815c42 -> org.sonar.plugins.design.batch.ProjectDsmDecorator@5e3e58b7 -> FileTangleIndexDecorator -> f(lines) -> f(generated_lines) -> f(ncloc) -> f(generated_ncloc) -> f(classes) -> f(packages) -> f(functions) -> f(accessors) -> f(statements) -> f(public_api) -> f(comment_lines) -> f(comment_blank_lines) -> f(public_undocumented_api) -> f(commented_out_code_lines) -> f(complexity) -> f(complexity_in_classes) -> f(complexity_in_functions) -> f(class_complexity_distribution) -> f(function_complexity_distribution) -> f(file_complexity_distribution) -> f(lines_to_cover) -> f(uncovered_lines) -> f(conditions_to_cover) -> f(uncovered_conditions) -> f(it_lines_to_cover) -> f(it_uncovered_lines) -> f(it_conditions_to_cover) -> f(it_uncovered_conditions) -> f(overall_lines_to_cover) -> f(overall_uncovered_lines) -> f(overall_conditions_to_cover) -> f(overall_uncovered_conditions) -> f(rfc) -> f(rfc_distribution) -> f(lcom4_distribution) -> f(package_cycles) -> f(package_tangles) -> f(package_feedback_edges) -> f(package_edges_weight) -> f(new_lines_to_cover) -> f(new_uncovered_lines) -> f(new_conditions_to_cover) -> f(new_uncovered_conditions) -> f(new_it_lines_to_cover) -> f(new_it_uncovered_lines) -> f(new_it_conditions_to_cover) -> f(new_it_uncovered_conditions) -> f(new_overall_lines_to_cover) -> f(new_overall_uncovered_lines) -> f(new_overall_conditions_to_cover) -> f(new_overall_uncovered_conditions) -> org.sonar.plugins.secrules.SecurityRulesDecorator@2d8d9743 -> org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator@1e9084ae -> CommentDensityDecorator -> org.sonar.plugins.uselesscodetracker.decorator.TotalDecorator@54cd399c -> PackageTangleIndexDecorator -> f(file_complexity) -> f(class_complexity) -> f(function_complexity) -> org.sonar.plugins.core.sensors.CoverageDecorator@47359fdc -> org.sonar.plugins.core.sensors.LineCoverageDecorator@1192490a -> org.sonar.plugins.core.sensors.BranchCoverageDecorator@1af93889 -> org.sonar.plugins.core.sensors.ItLineCoverageDecorator@205e90c9 -> org.sonar.plugins.core.sensors.ItCoverageDecorator@20738cb9 -> org.sonar.plugins.core.sensors.ItBranchCoverageDecorator@21bd654 -> org.sonar.plugins.core.sensors.OverallLineCoverageDecorator@719425e0 -> org.sonar.plugins.core.sensors.OverallCoverageDecorator@3542cf61 -> org.sonar.plugins.core.sensors.OverallBranchCoverageDecorator@353d0498 -> Common Rules for js -> org.sonar.plugins.core.issue.IssueTrackingDecorator@46b74109 -> CountUnresolvedIssuesDecorator -> CountFalsePositivesDecorator -> org.sonar.plugins.core.technicaldebt.DebtDecorator@12f8a3ee -> org.sonar.plugins.core.technicaldebt.NewDebtDecorator@1d267fd -> org.sonar.plugins.core.issue.WeightedIssuesDecorator@2a7675e3 -> IssuesDensityDecorator -> VariationDecorator -> QualityGateVerifier -> org.sonar.batch.qualitygate.GenerateQualityGateEvents@4466ba55
19:27:36.306 DEBUG - Download: http://sonar-server.hk.foo:9000/api/sources?resource=com.foo.bar:bar-atlas-web:app/js/graph-visualisations/filters-controller.js&format=txt (no proxy)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 36.532s
Final Memory: 18M/607M
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: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.File@af72877[key=app/js/graph-visualisations/filters-controller.js,deprecatedKey=graph-visualisations/filters-controller.js,path=app/js/graph-visualisations/filters-controller.js,dir=graph-visualisations,filename=filters-controller.js,language=JavaScript]'
at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:93)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:76)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:69)
at org.sonar.batch.phases.DecoratorsExecutor.decorateResource(DecoratorsExecutor.java:69)
at org.sonar.batch.phases.DecoratorsExecutor.execute(DecoratorsExecutor.java:61)
at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:135)
at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:178)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:199)
at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:194)
at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:187)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:56)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:44)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:175)
at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:163)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://sonar-server.hk.foo:9000/api/sources?resource=com.foo.bar:bar-atlas-web:app/js/graph-visualisations/filters-controller.js&format=txt]. Response code: 500
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:281)
at org.sonar.api.utils.HttpDownloader$BaseHttpDownloader$HttpInputSupplier.getInput(HttpDownloader.java:235)
at org.sonar.batch.bootstrap.ServerClient.request(ServerClient.java:88)
at org.sonar.batch.scan.LastSnapshots.loadSourceFromWs(LastSnapshots.java:61)
at org.sonar.batch.scan.LastSnapshots.getSource(LastSnapshots.java:51)
at org.sonar.plugins.core.issue.SourceHashHolder.getReferenceSource(SourceHashHolder.java:79)
at org.sonar.plugins.core.issue.SourceHashHolder.hasBothReferenceAndCurrentSource(SourceHashHolder.java:87)
at org.sonar.plugins.core.issue.IssueTracking.mapIssues(IssueTracking.java:82)
at org.sonar.plugins.core.issue.IssueTracking.track(IssueTracking.java:59)
at org.sonar.plugins.core.issue.IssueTrackingDecorator.doDecorate(IssueTrackingDecorator.java:118)
at org.sonar.plugins.core.issue.IssueTrackingDecorator.decorate(IssueTrackingDecorator.java:100)
at org.sonar.batch.phases.DecoratorsExecutor.executeDecorator(DecoratorsExecutor.java:85)
编辑:在sonar.log中,我同时收到以下错误:
2015.03.16 21:26:23 ERROR [o.s.s.ui.JRubyFacade] Fail to render: http://sonar-server.hk.foo:9000/api/sources?resource=com.foo.bar:bar-atlas-web:app/js/graph-visualisations/network-graph-directive.js&format=txt
Can only render or redirect once per action
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:891:in `render'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
jar:file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:51:in `render_with_benchmark'
/opt/sonarqube-4.3/web/WEB-INF/app/controllers/api/rest_controller.rb:53:in `rest_status_ko'
/opt/sonarqube-4.3/web/WEB-INF/app/controllers/api/rest_controller.rb:35:in `safe_rest'
/opt/sonarqube-4.3/web/WEB-INF/app/controllers/api/rest_controller.rb:33:in `safe_rest'
/opt/sonarqube-4.3/web/WEB-INF/app/controllers/api/rest_controller.rb:28:in `index'
org/jruby/RubyKernel.java:2223:in `send'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:1333:in `perform_action'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:617:in `call_filters'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:610:in `perform_action_with_filters'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
jar:file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-complete-1.7.9.jar!/META-INF/jruby.home/lib/ruby/1.8/benchmark.rb:308:in `realtime'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activesupport-2.3.15/lib/active_support/core_ext/benchmark.rb:17:in `ms'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/benchmarking.rb:68:in `perform_action_with_benchmark'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/rescue.rb:160:in `perform_action_with_rescue'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/flash.rb:151:in `perform_action_with_flash'
org/jruby/RubyKernel.java:2223:in `send'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:532:in `process'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/filters.rb:606:in `process_with_filters'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:391:in `process'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/base.rb:386:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/routing/route_set.rb:450:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:87:in `dispatch'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:85:in `dispatch'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:121:in `_call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
org/jruby/RubyProc.java:290:in `call'
org/jruby/RubyProc.java:224:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:29:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:9:in `cache'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/query_cache.rb:28:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/activerecord-2.3.15/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/string_coercion.rb:25:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/head.rb:9:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/methodoverride.rb:24:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/params_parser.rb:15:in `call'
file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/jruby/rack/session_store.rb:70:in `context'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/rack-1.1.6/lib/rack/session/abstract/id.rb:58:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/failsafe.rb:26:in `call'
/opt/sonarqube-4.3/web/WEB-INF/gems/gems/actionpack-2.3.15/lib/action_controller/dispatcher.rb:106:in `call'
file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:34:in `serve_rails'
file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/rack/adapter/rails.rb:39:in `call'
file:/opt/sonarqube-4.3/web/WEB-INF/lib/jruby-rack-1.1.13.2.jar!/rack/handler/servlet.rb:22:in `call'
答案 0 :(得分:0)
[已解决]我正在使用具有以下全局权限的用户的登录凭据执行Sonar Runner:
我认为这将允许此用户(从我的CI服务器运行Sonar的用户)运行所有可能的分析模式。它适用于完整分析模式,但为了允许预览/增量分析,我必须将用户添加到以下内置组:
这已经解决了我的问题,但我不确定为什么增量&预览模式需要的权限多于将更改写入数据库的模式!