【发布时间】:2018-02-17 05:39:11
【问题描述】:
我有带有默认配置的 sonarqube 6.5。当 sonar.forceAuthentication 标志设置为 false 时,我可以通过下面给出的命令创建和分析项目。
mvn sonar:sonar -Dsonar.host.url=https://mySonarHost/sonar -Dsonar.login=mySonarUserKey
当我启用 sonar.forceAuthentication 参数 (sonar.forceAuthentication=true) 时,我无法分析项目。我总是遇到 Maven 错误:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project storm: Not authorized. Please check the properties sonar.login and sonar.password. -> [Help 1]
它不适用于默认管理员帐户或创建的用户帐户(具有分析项目的权限)。我也尝试不使用用户密钥,但用户的登录名和密码(-Dsonar.login 和 -Dsonar.password 在 maven 配置中)但它也不起作用。
我尝试使用不同的声纳版本(从 4.5.7 到 5.6.6 到最新的 6.5,但我总是得到相同的结果)。
在连接期间,我的 access.log 中有这样的消息:
IP_ADDRESS - - [08/Sep/2017:12:03:33 +0200] "GET /sonar/batch/index HTTP/1.1" 200 - "-" "ScannerMaven/3.3.0.603/3.5.0" "SOME_KEY"
IP_ADDRESS - - [08/Sep/2017:12:03:33 +0200] "GET /sonar/api/settings/values.protobuf HTTP/1.1" 401 - "-" "ScannerMaven/3.3.0.603/3.5.0" "SOME_KEY"
我需要将 sonar.forceAuthentication 参数设置为 true(只有受信任的用户才能访问它)。
知道如何使用凭证参数通过 maven 配置和访问 sonarqube 吗?
【问题讨论】:
-
如果登录名/密码无效,您可能前面有一个身份验证反向代理。我做到了,但失败了。当我删除它时,它起作用了。也就是说,我还没有得到从 Maven 工作的令牌。你是否?我的问题在这里:stackoverflow.com/questions/48347351/…
标签: sonarqube authorization sonar-runner sonarqube-scan runner