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
The verticle started (also known as the main verticle) should be defined in the Main-Verticle attributes of the manifest.
plugins {
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'java'
}
mainClassName = 'io.vertx.core.Launcher'
shadowJar {
manifest{
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