Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting gradle to auto build after making code changes

Tags:

java

gradle

Is there a way to add something to the 'build.gradle' file to get it to auto build upon changes made to code within a project? Or are there any tricks with gradle or java to auto compile/build you project?

like image 519
Jamaal Avatar asked Jul 16 '15 16:07

Jamaal


People also ask

How do I sync Gradle?

Open your gradle. properties file in Android Studio. Restart Android Studio for your changes to take effect. Click Sync Project with Gradle Files to sync your project.

What is incremental build in Gradle?

Incremental build If neither a task's inputs nor its outputs have changed since the last time it was run, Gradle will not run it again. Incremental build is the name Gradle gives to this feature of checking inputs and outputs to determine whether a task needs to run again or not.


1 Answers

Use gradle --continuous myTask.

That's a feature of the brand new 2.5 version.

When you run with the --continuous or -t command line options, Gradle will not exit at the end of a build. Instead, Gradle will wait for files that are processed by the build to change. When changes are detected, Gradle will re-run the previous build with the same task selection.

See the Continuous Build user guide.

like image 182
JB Nizet Avatar answered Oct 03 '22 05:10

JB Nizet