关于您无权运行分析的问题。请联系sonarqube maven中的项目管理员

问题描述 投票:0回答:2

有人遇到这个问题吗? 当我尝试运行此命令时:

mvn clean verify sonar:sonar -Dsonar.projectKey=<ProjectName> -Dsonar.host.url=http://localhost:9000 -Dsonar.login=<AuthenticationKey>

结果是错误:您无权运行分析。请联系项目管理员

但将其更改为

mvn clean verify sonar:sonar -D sonar.projectKey=<ProjectName> -D sonar.host.url=http://localhost:9000 -D sonar.login=<AuthenticationKey>

运行完美。

不知道这算不算问题?有人可以解释一下吗?谢谢 该命令完全从 Sonarqube 复制而来

maven sonarqube
2个回答
0
投票

SonarQube 生成的代码给了我同样的问题,而且我有很多:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project <project.name>: You're not authorized to run analysis. Please contact the project administrator. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and     
try again.
At line:2 char:3
+   -D sonar.projectKey=<project.key> \
+   ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and     
try again.
At line:3 char:3
+   -D sonar.host.url=http://localhost:9000 \
+   ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
-D : The term '-D' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and     
try again.
At line:4 char:3
+   -D sonar.login=<sonar.login>
+   ~~
    + CategoryInfo          : ObjectNotFound: (-D:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

但是将所有内容放在一行后,删除

" \ "
加上
" -D sonar "
之间的空格,一切正常。


0
投票

我知道已经过去一年了,但我也有同样的问题。添加空间神奇地让它发挥作用。 (我正在 Gitlab CI 中为 Maven 项目运行它,仅供参考)。你知道这是为什么吗?我有点困惑为什么某些 cmd/终端的行为不同以及 mvn 或声纳如何处理参数来查看这种差异。

© www.soinside.com 2019 - 2024. All rights reserved.