How to fail a maven build, when quality gate fails?

こ雲淡風輕ζ 提交于 2021-01-27 13:21:38

问题


Earlier I use sonar-maven-plugin version 3.2 then when a Sonar quality gate fails the build also used to fail. Now I am using sonar-maven-plugin version 3.7.0.1746, it does not happen so. Even if quality gate fails maven build succeeded. Now when I use version 3.2 in pom.xml it gives the error

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) on project maven-webapp: Unable to execute SonarQube: Fail to download libraries from server -> [Help 1]

While using sonar-maven-plugin version 3.7.0.1746 doesn't give the above error.

This is how I add the plugin in Pom.xml

<plugin>
     <groupId>org.sonarsource.scanner.maven</groupId>
     <artifactId>sonar-maven-plugin</artifactId>
     <version>3.2</version>
</plugin>

I also got to know that in version 3.2 there was some post-job action like org.sonar.plugins.buildbreaker.QualityGateBreaker.

How can it be done now? I am using https://sonarcloud.io/ for sonar.

来源:https://stackoverflow.com/questions/60993190/how-to-fail-a-maven-build-when-quality-gate-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!