我正在运行SonarQube 4.0,正在使用针对Eclipse 3.7.2的3.3.0,20131115版本的Eclipse的SonarQube插件。
在服务器Sonarqube上,我安装了Sonar C ++ Community Plugin(0.9)插件。
该插件在“常规设置-> Sonar C ++社区插件”下可见。
我已经将我的C ++项目与SonarQube项目相关联,并且能够很好地从服务器端查看问题。
但是,如果我切换到本地分析,则会收到以下错误

Retrieve remote issues of project SonarCpp...

Start SonarQube analysis on SonarCpp...

INFO: SonarQube Server 4.0

10:53:55.754 INFO  - Incremental mode

10:53:55.756 INFO  - Load batch settings

10:53:55.896 INFO  - User cache: /home/sonar/.sonar/cache

10:53:56.155 INFO  - Install plugins

10:53:56.169 INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, report, scmactivity

10:54:06.304 INFO  - Create JDBC datasource for jdbc:h2:/home/sonar/workspaceSonar/.metadata/.plugins/org.eclipse.core.resources/.projects/SonarCpp/org.sonar.ide.eclipse.core/.sonartmp/preview1389261243496-0

10:54:07.979 INFO  - Initializing Hibernate

10:54:09.895 INFO  - Load project settings

10:54:09.953 INFO  - Apply project exclusions

10:54:10.168 INFO  - -------------  Scan SonarCpp

10:54:10.171 INFO  - Load module settings

10:54:10.555 INFO  - Quality profile : [name=Sonar way,language=cpp]

10:54:10.576 INFO  - Excluded tests:

10:54:10.576 INFO  -   **/package-info.java

10:54:10.649 INFO  - Index files

10:54:10.668 INFO  - 0 files indexed

10:54:10.676 INFO  - Loading technical debt model...

10:54:11.361 INFO  - Loading technical debt model done: 685 ms

Exception in thread "main" 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.impl.BatchLauncherMain.execute(BatchLauncherMain.java:41)

at org.sonar.runner.impl.BatchLauncherMain.main(BatchLauncherMain.java:59)

Caused by: org.sonar.api.utils.SonarException: Language with key 'cpp' not found

at org.sonar.batch.phases.ProjectInitializer.initLanguage(ProjectInitializer.java:52)

at org.sonar.batch.phases.ProjectInitializer.execute(ProjectInitializer.java:45)

at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:103)

at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)

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:190)

at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:185)

at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.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.ScanTask.scan(ScanTask.java:58)

at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)

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:155)

at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:143)

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:45)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)

... 6 more


错误日志中的跟踪:

java.lang.IllegalStateException: Error status [command: /opt/swe/tools/ext/sun/jdk-1.6.0.24/i686-linux2.6/jre/bin/java -cp /tmp/sonar-runner-impl3586719476372601521.jar org.sonar.runner.impl.BatchLauncherMain /tmp/sonar-project6640682178693273899.properties]: 1

at org.sonar.runner.api.ForkedRunner.fork(ForkedRunner.java:199)

at org.sonar.runner.api.ForkedRunner.doExecute(ForkedRunner.java:144)

at org.sonar.runner.api.Runner.execute(Runner.java:90)

at org.sonar.ide.eclipse.core.internal.jobs.AnalyseProjectJob.run(AnalyseProjectJob.java:283)

at org.sonar.ide.eclipse.core.internal.jobs.AnalyseProjectJob.run(AnalyseProjectJob.java:127)


at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


有什么建议么?

最佳答案

eclipse FORCE的插件声纳使用C ++商业插件。即不管你放什么
窗口->首选项->声纳->本地分析属性
sonar.language = c ++,未考虑在内。

换句话说,在本地模式下,在分析C ++项目时无法重新定义“ sonar.language”:它被强制为sonar.language = cpp(=> C ++商业插件)。从日食中的声纳插件到强制语言属性实在是可惜的。

提示,一种解决方法是通过在源代码中进行一些修改来重新定义C ++社区插件的语言符号(即cpp而不是c ++)。

关于c++ - 由于未找到异常语言“cpp”, eclipse 中的 Sonar 分析失败并引发本地分析错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21017860/

10-10 18:31
查看更多