无法在eclipse中运行sonarqube插件

时间:2014-08-22 06:14:10

标签: java sonarqube

我想在eclipse中使用sonarqube插件。我把它与声纳服务器联系起来似乎没问题。分析期间出现问题。输出表示Access to the secured property 'sonar.scm.user.secured' is not possible in preview mode. The SonarQube plugin which requires this property must be deactivated in preview mode.。我尝试通过sonar.scm.user.secured将属性false设置为值disabledhudsonWindow->Preferences->SonarQube->Preview Analysis Properties,但说实话我不知道应该具有什么样的价值组。这是声纳中声纳返回的整个输出:

Retrieve remote issues of project proj-gui...
Start SonarQube analysis on proj-gui...
INFO: SonarQube Server 4.2
08:07:02.474 INFO  - Incremental mode
08:07:02.476 INFO  - Load batch settings
08:07:02.802 INFO  - User cache: C:\Users\user\.sonar\cache
08:07:02.810 INFO  - Install plugins
08:07:02.875 INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker
08:07:05.422 INFO  - Create JDBC datasource for jdbc:h2:C:\Users\user\proj-workspace-kepler-git2\.metadata\.plugins\org.eclipse.core.resources\.projects\proj-gui\org.sonar.ide.eclipse.core\.sonartmp\preview1408687623081-0
08:07:06.669 INFO  - Initializing Hibernate
08:07:08.174 INFO  - Load project settings
08:07:08.330 INFO  - Apply project exclusions
08:07:08.487 INFO  - -------------  Scan proj-gui
08:07:08.489 INFO  - Load module settings
08:07:09.164 INFO  - Language is forced to java
08:07:09.172 INFO  - Loading technical debt model...
08:07:09.422 INFO  - Loading technical debt model done: 251 ms
08:07:09.430 INFO  - Configure Maven plugins
08:07:09.650 INFO  - Compare to previous analysis (2014-08-22)
08:07:09.660 INFO  - Compare over 30 days (2014-07-23, analysis of 2014-08-04 09:08:17.0)
08:07:09.669 INFO  - Compare to previous version (2014-08-22)
08:07:09.780 INFO  - Base dir: C:\project\proj-gui
08:07:09.780 INFO  - Working dir: C:\Users\user\proj-workspace-kepler-git2\.metadata\.plugins\org.eclipse.core.resources\.projects\proj-gui\org.sonar.ide.eclipse.core
08:07:09.780 INFO  - Source dirs: C:\project\proj-gui\src\main\java
08:07:09.780 INFO  - Test dirs: C:\project\proj-gui\src\test\java
08:07:09.780 INFO  - Binary dirs: C:\project\proj-gui\target\classes
08:07:09.781 INFO  - Source encoding: windows-1252, default locale: en_US
08:07:09.781 INFO  - Index files
08:07:10.221 INFO  - 22 files indexed
08:07:10.317 INFO  - Quality profile for java: Profile 1.5
08:07:10.325 INFO  - JaCoCo report not found.
08:07:10.326 INFO  - JaCoCo IT report not found.
08:07:10.326 INFO  - JaCoCo reports not found.
08:07:10.326 INFO  - Trying to guess scm provider from project layout...
08:07:10.327 INFO  - Found SCM type: git
08:07:10.341 INFO  - Sensor JavaSquidSensor...
08:07:10.404 INFO  - Java Main Files AST scan...
08:07:10.407 INFO  - 22 source files to be analyzed
08:07:11.541 INFO  - 22/22 source files analyzed
08:07:11.563 INFO  - Java Main Files AST scan done: 1159 ms
08:07:11.617 INFO  - Java bytecode scan...
08:07:11.894 INFO  - Java bytecode scan done: 277 ms
08:07:11.895 INFO  - Java Test Files AST scan...
08:07:11.895 INFO  - 0 source files to be analyzed
08:07:11.895 INFO  - Java Test Files AST scan done: 0 ms
08:07:11.901 INFO  - Package design analysis...
08:07:11.905 INFO  - 0/0 source files analyzed
08:07:11.920 INFO  - Package design analysis done: 19 ms
08:07:11.954 INFO  - Sensor JavaSquidSensor done: 1613 ms
08:07:11.954 INFO  - Sensor Quality gate loader...
08:07:11.954 INFO  - Sensor Quality gate loader done: 0 ms
08:07:11.954 INFO  - Sensor QProfileSensor...
08:07:11.955 INFO  - Sensor QProfileSensor done: 1 ms
08:07:11.955 INFO  - Sensor FindbugsSensor...
08:07:11.957 INFO  - Execute Findbugs 2.0.3...
08:07:14.188 INFO  - Findbugs output report: C:\Users\user\proj-workspace-kepler-git2\.metadata\.plugins\org.eclipse.core.resources\.projects\proj-gui\org.sonar.ide.eclipse.core\findbugs-result.xml
08:07:24.351 INFO  - Execute Findbugs 2.0.3 done: 12394 ms
08:07:24.428 INFO  - Sensor FindbugsSensor done: 12473 ms
08:07:24.428 INFO  - Sensor ScmStatsSensor...
08:07:24.429 INFO  - Collection SCM Change log for the last 0 days
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: Access to the secured property 'sonar.scm.user.secured' is not possible in preview mode. The SonarQube plugin which requires this property must be deactivated in preview mode.
    at org.sonar.batch.scan.ModuleSettings.doOnGetProperties(ModuleSettings.java:130)
    at org.sonar.api.config.Settings.getClearString(Settings.java:110)
    at org.sonar.api.config.Settings.getString(Settings.java:95)
    at org.sonar.plugins.scmstats.ScmConfiguration.getUser(ScmConfiguration.java:63)
    at org.sonar.plugins.scmstats.ScmFacade$ScmRepositorySupplier.get(ScmFacade.java:89)
    at org.sonar.plugins.scmstats.ScmFacade$ScmRepositorySupplier.get(ScmFacade.java:83)
    at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:109)
    at org.sonar.plugins.scmstats.ScmFacade.getScmRepository(ScmFacade.java:67)
    at org.sonar.plugins.scmstats.ScmFacade.getChangeLog(ScmFacade.java:52)
    at org.sonar.plugins.scmstats.ScmStatsSensor.analyseChangeLog(ScmStatsSensor.java:76)
    at org.sonar.plugins.scmstats.ScmStatsSensor.analyse(ScmStatsSensor.java:65)
    at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:79)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:70)
    at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:134)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:186)
    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:144)
    at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
    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(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 6 more

是否可以从eclipse修复它或者我需要在声纳服务器上更改某些内容吗?

声纳版本:4.2

sonarqube版本:3.3.0(更新至3.4.0)

1 个答案:

答案 0 :(得分:9)

错误是由ScmStatsSensor引起的。您需要将“scmstats”添加到要从预览扫描中排除的插件列表中。来自the docs

  

排除插件

     

由于sonar.preview.excludePlugins(SonarQube 4.0之前是sonar.dryRun.excludePlugins)属性,可以跳过一些插件(用于预览分析无用)。可以通过SonarQube Web界面设置此属性:设置>一般设置>一般>一般)。   默认值为“devcockpit,pdfreport,report,scmactivity,views,jira”。例如,要跳过Build Stability插件(由于https://jira.codehaus.org/browse/SONARIDE-346),请将该属性设置为“devcockpit,pdfreport,report,scmactivity,views,jira,buildstability”。

您还可以在Eclipse中以全局或项目级别设置此属性。右键单击项目根目录,然后转到Properties / SonarQube / Preview Analysis Properties。如果您只想为该项目排除该属性,请在此处添加该属性,或单击“配置工作区设置”并将其添加到那里以涵盖所有项目。您当前的排除列表显示在上面的输出中

08:07:02.875 INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker

所以属性值应为:

devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker, scmstats