android - Gradle Sonar 运行者 : fail build on failed Quality Gate

标签 android gradle sonarqube teamcity sonar-runner

我正在 Android 代码上执行 Gradle SonarRunner 任务,作为 Team City 构建的一部分。

在 SonarQube 上质量门失败,但控制台构建成功,并且日志中没有有关失败的 QG 的信息:

[10:57:35][Step 1/3] 10:57:36.323 INFO  - Loaded quality gate 'Android'
[10:57:36][Step 1/3] 10:57:36.397 INFO  - Compare to previous analysis (2015-12-07)
[10:57:36][Step 1/3] 10:57:36.405 INFO  - Compare over 30 days (2015-11-08, analysis of Thu Nov 26 13:27:50 CET 2015)
[10:57:36][Step 1/3] 10:57:36.411 INFO  - Compare to previous version (2015-12-07)
[10:57:36][Step 1/3] 10:57:36.642 INFO  - Execute decorators...
[10:58:19][Step 1/3] 10:58:20.189 INFO  - Store results in database
[10:58:59][Step 1/3] 10:59:00.330 INFO  - Analysis reports generated in 2698ms, dir size=4 MB
[10:59:09][Step 1/3] 10:59:09.888 INFO  - Analysis reports compressed in 9558ms, zip size=3 MB
[10:59:09][Step 1/3] 10:59:10.245 INFO  - Analysis reports sent to server in 357ms
[10:59:09][Step 1/3] 10:59:10.245 INFO  - ANALYSIS SUCCESSFUL, you can browse [###############]
[10:59:09][Step 1/3] 10:59:10.245 INFO  - Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report.
[10:59:10][Step 1/3] INFO: ------------------------------------------------------------------------
[10:59:10][Step 1/3] INFO: EXECUTION SUCCESS
[10:59:10][Step 1/3] INFO: ------------------------------------------------------------------------
[10:59:10][Step 1/3] Total time: 6:05.725s
[10:59:10][Step 1/3] Final Memory: 44M/1294M
[10:59:10][Step 1/3] INFO: ------------------------------------------------------------------------
[10:59:10][Step 1/3] 
[10:59:10][Step 1/3] BUILD SUCCESSFUL

我想通过使 Gradle 任务失败或至少检查日志中的某些特定失败消息(例如“分析失败”)来识别此类事件。我怎样才能实现这个目标?

最佳答案

您没有提及您的 SonarQube 服务器版本。破坏构建在当前服务器版本 5.2 中不可用,但在 v5.1 及之前的 the Build Breaker Plugin 中存在。和 native 支持 should return soon .

关于android - Gradle Sonar 运行者 : fail build on failed Quality Gate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34153961/

相关文章:

android - Transloadit Dependency 对于编译(x)和运行时(y)有不同的版本

java - 传递对象数组而不是不确定数量的对象

android - 不断更新列表项

android - 我如何使用 smack 客户端 ejabberd 从 mysql 数据库检索聊天记录

java - 运行 getDisplayMetrics() 方法时,使用 gradle 编译给出的值与使用 eclipse 编译的值不同

java - 如何将资源目录而不是单个文件包含到编译类路径中?

eclipse - 无法访问您的 SonarQube 服务器之一。请检查您的连接设置

mysql - 运行 "sonar-runer"时抛出异常:"Caused by: Unknown database status: FRESH_INSTALL"

java - sonarqube eclipse 插件用法

android - 与 neon 内在函数中的 float 比较