Vert.x - Hot reloading / Live redeploy

About

Java - Hot Reload in Vert.x

On matching file changes, the process is stopped and the application is restarted.

Example

Launcher

Vert.x - Launcher class

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:

vertx run \
    org.acme.verticle.MyMainVerticle \
    --redeploy="src/**/*.java" \
    --launcher-class=io.vertx.core.Launcher
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"

Documentation


Powered by ComboStrap