我想在 eclipse 中使用 sonarqube 插件。我已将其与 Sonar 服务器链接,似乎没问题。问题发生在分析过程中。输出表示 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
设置为值 disabled
、 hudson
、 Window->Preferences->SonarQube->Preview Analysis Properties
但老实说我不知道我应该设置什么样的值。这是 Sonar 在 eclipse 中返回的整个输出:
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 中修复它,或者我是否需要在 Sonar 服务器上更改某些内容?
Sonar 版本:4.2
sonarqube 版本:3.3.0(更新到 3.4.0)
最佳答案
该错误是由 ScmStatsSensor 引起的。您需要将“scmstats”添加到要从预览扫描中排除的插件列表中。来自 the docs :
您还可以在 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
关于java - 无法在 Eclipse 中运行 sonarqube 插件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25440651/