How to hot-reload with vert.x 5 VertxApplication launcher

37 views
Skip to first unread message

Aleksandar Pavlovic

unread,
Aug 28, 2025, 9:13:56 AMAug 28
to vert.x
Hi everyone, 

We've started migration from vert.x 4 to vert.x 5. With vert.x 4, we are using Gradle with a customized run task similar to this:

val vertxRunTask = getByName<JavaExec>("run") {
systemProperty(
"vertx.logger-delegate-factory-class-name",
"io.vertx.core.logging.Log4j2LogDelegateFactory"
)
args = listOf(
"run",
com.acme.app.MyVerticle,
"-conf",
"conf/config.json",
"--redeploy=
src/main/kotlin/**/*",
"--launcher-class=io.vertx.core.Launcher",
"--on-redeploy=
../gradlew classes",
)
}

The redeploy arguments give us a hot-reload development experience.

After the upgrade to vert.x 5.0.3 and based on vertx-5-migration-guide, we added a new dependency to the project and changed the Gradle configuration as follows:
val runVertxTask = getByName<JavaExec>("run") {
systemProperty(
"vertx.logger-delegate-factory-class-name",
"io.vertx.core.logging.Log4j2LogDelegateFactory"
)
args = listOf(
mainVerticle,
"-conf",
"conf/config.json",
"--redeploy=src/main/kotlin/**/*",
"--on-redeploy=../gradlew classes",
)
}

The last 2 arguments:
--redeploy
--on-redeploy
makes the Gradle run task fail. 

When I remove them, my application starts, but is insensitive to any change in the code base.

I've tried to analyze the source code changes between v4 (launcher belongs to vert.x core module) and v5 (separated module), and what is possibly missing. As far as I see, RunCommand is the same, and the Watcher class is present in the source code. 

Someone had/have the same problem? How did you solve it?

Thanks

Thomas SEGISMONT

unread,
Aug 28, 2025, 12:45:45 PMAug 28
to ve...@googlegroups.com
Hi,

I think it should work if you add the vertx-launcher-legacy-cli library


The CLI framework has been removed in Vert.x 5. You can rely on the legacy CLI jar for now but there is no guarantee it will be maintained for the whole Vert.x 5 lifetime (although, as long as it doesn't break, I believe we'll keep it).

It seems you need the redeployment feature for development. This feature is now present in the Vert.x Maven plugin but not in the Vert.x Gradle plugin.

We're looking for a contributor to this project, would be interested?

Thanks,
Thomas

--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/vertx/dec449cf-ebaf-42b8-8a0a-28e0f013e692n%40googlegroups.com.
Message has been deleted

Aleksandar Pavlovic

unread,
Sep 8, 2025, 9:59:56 AMSep 8
to vert.x
Hi, 

We have used vert.x gradle plugin for some time, until we removed it from our projects due to changes in the Gradle API. The problem was the shadow plugin. Incompatibility with Gradle version 8, as far as I remember. 

To be clear, I'm not the Gradle expert. I've developed some internal plugins for our company, and nothing else. 

Anyway, I did some research on vertx-gradle-plugin and how it deals with the hot-reload process. All in all, the internal logic relies completely on legacy vert.x launcher. 
It's the wrapper of vertx. core launcher e shadow plugin task. If the vert.x legacy cli will be dropped in the future, we will have the same problem as we have now. 

The main problem is that the Gradle JavaExec task doesn't support continuous execution, unlike compile and test tasks (ex. ./gradlew test --continuous). As far as I know, a couple of requests were made by the community a few years ago, but Gradle didn't follow through, at least not officially.

I'm willing to contribute to the Gradle plugin, but I'm not sure what should be a good strategy, considering how much the Gradle team has changed its internal APIs over the last years and announced deprecation of vert.x legacy cli!

Thomas SEGISMONT

unread,
Sep 11, 2025, 1:02:11 PMSep 11
to ve...@googlegroups.com
Hi,

In the version 2 of the Vert.x Maven plugin, there is some code for file changes monitoring already: https://github.com/reactiverse/vertx-maven-plugin/blob/master/src/main/java/io/reactiverse/vertx/maven/plugin/utils/FileChangesHelper.java

You could start from there.

I'll write to you off list.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages