SonarQube
💥
Build Breaker
![Maven Central](https://camo.githubusercontent.com/846b1aa98283a2b332b29eeafd7df200669b39bc73ce2bdd428d0a8f89c295c5/68747470733a2f2f6d6176656e2d6261646765732e6865726f6b756170702e636f6d2f6d6176656e2d63656e7472616c2f636f6d2e6769746875622e6461676765726f6b2e736f6e61722f736f6e61722d7175616c6974792d67617465732d6275696c642d627265616b65722f62616467652e737667)
SonarQube Build Breaker designed to fail SonarQube analysis during CI pipeline build if quality grates not passed
Easy as 1-2-3
Maven plugin quick start
-
add
sonar-breaker-maven-plugin
in your project pom.xml file:<project> <build> <plugins> <plugin> <groupId>com.github.daggerok.sonar</groupId> <artifactId>sonar-breaker-maven-plugin</artifactId> <version>1.0.1</version> <!-- <configuration> <delay>1</delay> <retry>100</retry> <standalone>false</standalone> <allowFailure>false</allowFailure> <projectBaseDir>${maven.multiModuleProjectDirectory}</projectBaseDir> <metadataFilePath>${maven.multiModuleProjectDirectory}/target/sonar/report-task.txt</metadataFilePath> <metricsExcludes>new_coverage</metricsExcludes> </configuration> --> </plugin> </plugins> </build> </project>
see sonar-breaker-maven-plugin pom.xml file
-
NOTE: Do not forget setup
sonar-maven-plugin
as well,sonar-breaker
will be use analysis metadata generated bysonar:sonar
goal execution -
build project, run sonar analysis and run sonar-breaker analyzer:
mvn clean install sonar:sonar sonar-breaker:analyze
Sonar Breaker standalone quick start
-
build project and examin sonar analysis:
mvn install sonar:sonar
-
download latest sonar-breaker executable jar file.
wget -O sb.jar https://repo1.maven.org/maven2/com/github/daggerok/sonar/sonar-breaker/1.0.1/sonar-breaker-1.0.1.jar
-
finally run sonar-breaker analysis:
java -jar sb.jar target/sonar/report-task.txt
see examples
enjoy your bugs free code!