I have a pom.xml file with some groovy code that is run by gmaven-plugin. I would like to detect if a setting is missing and then have maven exit with 'BUILD FAILURE'. I would prefer to be able to display an error message as well, but I can manually do that so no big deal. This works but is very ugly (since it makes maven say "Exception: / by zero")
testResult = true
if (testResult) {
println "good keep going"
} else {
println "bad make maven fail"
someVal = 1.0 / 0.0
}
You can always explicitly throw an exception, e.g.:
throw new RuntimeException('build is failing! call the fire brigade!');