This script uses spring-loaded to provide hot swap functionality to Gradle application projects. It does not create any new tasks to start your application, instead it uses the well known application's plugin run
task.
- Make sure the build.gradle file from the target project has the application plugin applied (
apply plugin: 'application'
); - Make sure your IDE are compiling the sources after change or on save;
- Add this line to your build.gradle file:
apply from: "https://raw.github.com/thomas-adriano/gradle-hot-swap/master/hot-swap.gradle"
- Execute the
run
task from Gradle application plugin
- Adding spring-loaded parameters to JVM initialization (via applicationDefaultJvmArgs)
- (re)generating Eclipse .classpath and IntelliJ .iml files to change the output dir to gradle's output dir (necessary to spring-loaded watching process)
- The target project must have the Gradle application plugin applied (
apply plugin: 'application'
); - The IDE must compile the sources after save or change;
- In eclipse, after the first time the
gradle run
(application plugin task) is executed, you have to refresh the target project, otherwise hot swap will just not work.