Vert.x - Fat Jar with Vertx Launcher

Java Conceptuel Diagram


How to create a fat jar that wraps the vert.x launcher or a custom launcher to be able to use its commands

With the launcher as the main class in a fat jar,


Once the launcher is wrapped, you can call its commands like that

java -jar myapp.jar command args


For instance:

java -jar my-vertx-fat.jar run -cluster -conf myconf.json -cp path/to/dir/conf/cluster_xml
java -jar my-verticle-fat.jar start --vertx-id=my-app-name
java -jar my-verticle-fat.jar stop my-app-name
java -jar my-verticle-fat.jar list

Why ? because the below fat jar call

java -jar my-vertx-fat.jar 

is equivalent to

java -cp my-vertx-app.jar io.vertx.core.Launcher com.myexample.MyMainVerticle


Default command

  • The launcher will execute the run command (default).
  • The default command is used if the fat jar is launched without a command.
  • You can configure the default command by setting the Main-Command MANIFEST entry.


The verticle started (also known as the main verticle) should be defined in the Main-Verticle attributes of the manifest.

Build tool


plugins {
  id 'com.github.johnrengelman.shadow' version '5.2.0'
  id 'java'

mainClassName = 'io.vertx.core.Launcher'

shadowJar {
    attributes 'Main-Verticle': 'com.myexample.MyMainVerticle'
    attributes 'Main-Command': 'run'
  mergeServiceFiles {
    include 'META-INF/services/io.vertx.core.spi.VerticleFactory'

where docs/apidocs/io/vertx/core/spi/VerticleFactory.html


Discover More
Java Conceptuel Diagram
Vert.x - Deployment

in Vert.x You have two ways to deploy your Vert.x application. You can provide: a fat jar that contains all dependency on only the verticle when you have already a vert.x distribution. main class...
Java Conceptuel Diagram
Vert.x - Docker

Docker as a distribution unit to distribute an run a vert.x application Example: where: anapsix/alpine-java is the java alpine image vertx-application-fat.jar...
Vertx Launcher Idea Run
Vert.x - Launcher class

The io/vertx/core/LauncherVertx launcher is one of the two way to start an application It is a launcher class that wraps the management of a vertx instance and the deployment of a main verticle. It can...
Java Conceptuel Diagram
Vert.x - The launcher run command

The run command (Code) is a command of the launcher. It will: create a instance...

Share this page:
Follow us:
Task Runner