3
votes

I want to use sonarqube plugin in eclipse. I've linked it with sonar server and it seems to be ok. The problem occurs during analysis. Output says that 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.. I tried to set property sonar.scm.user.secured to values false, disabled, hudson via Window->Preferences->SonarQube->Preview Analysis Properties but to be honest I don't know what kind of value should I set. This is the whole output returned by sonar in 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

Is it possible to fix it from eclipse or do I need to change something on sonar server?

sonar version: 4.2

sonarqube version: 3.3.0 (updated to 3.4.0)

1

1 Answers

9
votes

The error is caused by ScmStatsSensor. You need to add "scmstats" to the list of plugins to be excluded from the preview scan. From the docs:

Excluding Plugins

Some plugins (useless for a preview analysis) can be skipped thanks to the sonar.preview.excludePlugins (was sonar.dryRun.excludePlugins prior to SonarQube 4.0) property. This property can be set through the SonarQube web interface: Settings > General Settings > General > General). The default value is "devcockpit,pdfreport,report,scmactivity,views,jira". For example, to skip the Build Stability plugin (due to https://jira.codehaus.org/browse/SONARIDE-346), set the property to "devcockpit,pdfreport,report,scmactivity,views,jira,buildstability".

You can also set this property in Eclipse at global or project level. Right click on your project root and go to Properties / SonarQube / Preview Analysis Properties. Add the property there if you just want to exclude it for that project, or click "Configure Workspace Settings" and add it there to cover all projects. Your current exclusions list is shown in the output above

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

so the property value should be :

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