16 - how to stop build execution

This commit is contained in:
Juraj Michalek
2014-05-13 10:48:36 +02:00
parent fe7b073aa8
commit 0e30e1333d
2 changed files with 23 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
task workingTask {
description 'Task that works'
doLast {
println 'Everything is ok'
}
}
task failingTask {
description 'Task that fails'
doLast {
throw new GradleException("Problem detected. Build failed")
}
}

View File

@@ -163,3 +163,11 @@ Plugin is just counting lines in build.gradle file in current directory.
gradle tasks
gradle countLines
## 16-stop-build
It is possible to stop build by throwing exception.
gradle workingTask
gradle failingTask