Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended way to stop a Gradle build

How can I stop a Gradle build after detecting a problem? I can use an assert, throw an exception, do a System.exit (bad idea), or use a dedicated function in Gradle (but I could not find one). What is the best way for Gradle (and why?).

like image 958
Kartoch Avatar asked Apr 25 '12 08:04

Kartoch


People also ask

How do I stop Gradle testing?

We can do this by passing the command-line option --fail-fast when we run the test task in Gradle. With this option Gradle will stop the build and report a failure at the first failing test.

Why does Gradle build takes so long?

Check your Internet connection. If internet speed is very slow gradle build will also take long time to build. I check by change my wifi internet connection with another one good speed connection. Now build time is normal.


1 Answers

I usually throw the relevant exception from the org.gradle.api package, for example InvalidUserDataException for when someone has entered something invalid, or GradleScriptException for more general errors.

If you want to stop the current task or action, and move on to the next, you can also throw a StopActionException

like image 140
tim_yates Avatar answered Sep 23 '22 04:09

tim_yates