我们希望允许任何用户运行SonarQube预览分析(是否经过身份验证)。但是,我们希望限制哪些人可以将分析上传到服务器。
为了让所有用户都能运行预览分析,文档指出任何用户都需要访问Browse and Execute Analysis。
但是,似乎在命令行运行maven声纳插件仍然需要sonar.login和sonar.password。
此外,我们希望限制谁可以将分析仅上传到声纳管理员组。
命令不成功:
mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json
成功的命令:
mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json -Dsonar.login=%SONAR_USERNAME% -Dsonar.password=%SONAR_PASSWORD%
请帮助我微调我们的访问选项,以便我们实现允许预览分析的目标,但不包括推送分析的能力。
以下是失败工作的一些摘录。我删除了一些公司特定的细节。
> mvn -o org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar -Dsonar.analysis.mode=preview -Dsonar.branch=$BRANCH -Dsonar.host.url=$SONAR_URL -Dsonar.skipPackageDesign=true -Dsonar.report.export.path=sonar-report.json
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=512m; support was removed in 8.0
...
[INFO] Performing issue tracking
[INFO] 772/772 components tracked
[WARNING] Console report is deprecated. Use SonarLint CLI to have local reports of issues
[INFO]
------------- Issues Report -------------
+13 issues
+1 blocker
+1 critical
+3 major
+8 minor
-------------------------------------------
[INFO] Export issues to c:\Source\releases\vcmmigrationmgr\vcmmigrationmgr-app\target\sonar\sonar-report.json
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 35.933 s
[INFO] Finished at: 2017-04-25T10:59:46-05:00
[INFO] Final Memory: 100M/3582M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project vcmmigrationmgr-app: Not authorized. Analyzing this project requires to be authenticated. Please provide the values of the properties sonar.login and sonar.password. -> [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
编辑:我删除了"执行分析"来自任何人的许可。我也删除了 " -Dsonar.report.export.path =声纳-report.json"从命令。我不明白为什么预览模式需要用户名和密码。有没有办法允许匿名用户在预览模式下运行?