Vert.x - Hot reloading / Live redeploy
Table of Contents
About
Java - Hot Reload in Vert.x
On matching file changes, the process is stopped and the application is restarted.
Articles Related
Example
Launcher
java io.vertx.core.Launcher run org.acme.MyVerticle --redeploy="**/*.class" --launcher-class=io.vertx.core.Launcher -cp ...
Vertx command line
Live redeploy with the vertx command of:
- a verticle with the launcher
vertx run \
org.acme.verticle.MyMainVerticle \
--redeploy="src/**/*.java" \
--launcher-class=io.vertx.core.Launcher
- a Main
vertx run \
--redeploy="src/**/*.java" \
--launcher-class=org.acme.vertx.Main
Groovy:
vertx run MyVerticle.groovy --redeploy="**/*.groovy" --launcher-class=io.vertx.core.Launcher
vertx run MyVerticle.groovy --redeploy="**/*.groovy,**/*.rb" --launcher-class=io.vertx.core.Launcher
Gradle
Live reload of a Main class
mainClassName = 'net.bytle.api.Main'
def watchForChange = 'src/main/java/net/**/*'
def doOnChange = './gradlew classes'
run {
args = ['run', "--redeploy=$watchForChange", "--launcher-class=$mainClassName", "--on-redeploy=$doOnChange"]
}
equivalent to
vertx run --redeploy=src/**/* --launcher-class=net.bytle.api.Main --on-redeploy="./gradlew classes"