简体   繁体   中英

How to fail maven goal sonar:sonar based on quality gates

How to fail maven goal sonar:sonar based on quality gates rules? I run it for local builds, for CI I already wrote a script according to http://docs.sonarqube.org/display/SONAR/Breaking+the+CI+Build So, if quality gates validation fails then goal also should fails

我将脚本添加为post step命令,因此在构建成功后,脚本会检查质量是否正确,如果不正常则会中断作业。

You can use the SonarQube Build Breaker plugin .

It's a controversy feature as explained in the blog post Why You Shouldn't Use Build Breaker .

It is also possible to integrate with Jenkins use web hook (see the blog post Breaking the SonarQube Analysis with Jenkins Pipelines ).

如果 Sonar Qube 版本大于 8.1,可以使用以下命令:

mvn verify sonar:sonar -Dsonar.qualitygate.wait=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM