执行 Sonarqube 分析时出错“权限不足”
Error while executing Sonarqube analysis " Insufficient privileges"
我正在尝试通过 sonarqube 分析 java 代码。我们在本地环境中创建了一个 sonarqube 服务器,但没有使用 sonar cloud。
我尝试使用 sonar maven 插件最初形成这个 link Sonar-Maven Plugin
但是我遇到了 "Insufficient privileges" 错误。
[INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 22.185 s [INFO] Finished at: 2017-09-18T13:04:47+10:00 [INFO] Final Memory: 64M/589M [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:
3.3.0.603:sonar (default-cli) on project testproject: Insufficient privileges -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o rg.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project testproject: Insufficient privileges
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl eStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 356) Caused by: org.apache.maven.plugin.MojoExecutionException: Insufficient privileg es
at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(Exce ptionHandling.java:36)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(S cannerBootstrapper.java:80)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.jav a:139)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:208)
... 20 more Caused by: Insufficient privileges [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
然后我尝试使用 Sonar runner 进行分析,我再次遇到相同的 "Insufficient privileges" 错误。
13:01:41.145 DEBUG: Upload report
13:01:41.179 DEBUG: POST 403 http://myserver:9000/api/ce/submit?projectKey=
SampleProject&projectName=sampleprojectWrapper | time=34ms
13:01:41.208 INFO: -------------------------------------------------------------
-----------
13:01:41.209 INFO: EXECUTION FAILURE
13:01:41.209 INFO: -------------------------------------------------------------
-----------
13:01:41.211 INFO: Total time: 12.919s
13:01:41.412 INFO: Final Memory: 52M/320M
13:01:41.413 INFO: -------------------------------------------------------------
-----------
13:01:41.414 ERROR: Error during SonarQube Scanner execution
Insufficient privileges
然后我创建了一个新的 Sonarqube 服务器并重新运行 执行,它运行良好。
我试图找出第一台服务器出了什么问题。服务器和项目的配置相同。
提前致谢。
如 中所述,检查您在工作中使用的 SonarQube 用户权限:
global
:执行分析
project
:浏览并查看源代码
这些可能默认在您的新 SonarQube 服务器中。
作为 OP VVP confirms :
Yes the problem was "Anyone" group was removed somehow and this prevented code from being pushed to SonarQube.
只是关于如何解决这个问题的更新。
我正在使用 Sonar runner 来分析代码。
问题是 "Anyone" 组的权限以某种方式被删除了。按照上面的回答,我再次添加了权限,执行,我可以看到发布的结果。
我正在尝试通过 sonarqube 分析 java 代码。我们在本地环境中创建了一个 sonarqube 服务器,但没有使用 sonar cloud。
我尝试使用 sonar maven 插件最初形成这个 link Sonar-Maven Plugin
但是我遇到了 "Insufficient privileges" 错误。
[INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 22.185 s [INFO] Finished at: 2017-09-18T13:04:47+10:00 [INFO] Final Memory: 64M/589M [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:
3.3.0.603:sonar (default-cli) on project testproject: Insufficient privileges -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o rg.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project testproject: Insufficient privileges
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje ct(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThre adedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl eStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun cher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav a:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La uncher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java: 356) Caused by: org.apache.maven.plugin.MojoExecutionException: Insufficient privileg es
at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(Exce ptionHandling.java:36)
at org.sonarsource.scanner.maven.bootstrap.ScannerBootstrapper.execute(S cannerBootstrapper.java:80)
at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.jav a:139)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default BuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor .java:208)
... 20 more Caused by: Insufficient privileges [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
然后我尝试使用 Sonar runner 进行分析,我再次遇到相同的 "Insufficient privileges" 错误。
13:01:41.145 DEBUG: Upload report
13:01:41.179 DEBUG: POST 403 http://myserver:9000/api/ce/submit?projectKey=
SampleProject&projectName=sampleprojectWrapper | time=34ms
13:01:41.208 INFO: -------------------------------------------------------------
-----------
13:01:41.209 INFO: EXECUTION FAILURE
13:01:41.209 INFO: -------------------------------------------------------------
-----------
13:01:41.211 INFO: Total time: 12.919s
13:01:41.412 INFO: Final Memory: 52M/320M
13:01:41.413 INFO: -------------------------------------------------------------
-----------
13:01:41.414 ERROR: Error during SonarQube Scanner execution
Insufficient privileges
然后我创建了一个新的 Sonarqube 服务器并重新运行 执行,它运行良好。 我试图找出第一台服务器出了什么问题。服务器和项目的配置相同。
提前致谢。
如
global
:执行分析project
:浏览并查看源代码
这些可能默认在您的新 SonarQube 服务器中。
作为 OP VVP confirms
Yes the problem was "Anyone" group was removed somehow and this prevented code from being pushed to SonarQube.
只是关于如何解决这个问题的更新。
我正在使用 Sonar runner 来分析代码。
问题是 "Anyone" 组的权限以某种方式被删除了。按照上面的回答,我再次添加了权限,执行,我可以看到发布的结果。