0
votes

I'm a beginner with Vertx and I'm using this link as the starter code.

However, there is no main file and I don't see how the MainVerticle is deployed. I would like to set some deployment options for the MainVerticle but since there is no main file; how would I do that?

3
see the section: vertx.io/docs/guide-for-java-devs/… you build a fat-jar with maven and just run the jar with java -jar target/yourApp-fat.jar - taygetos

3 Answers

0
votes

I recommend this link for you to improve your vert.x knowledge from zero to hero.You will be able to make a crud application using this repository.

https://github.com/saranglohar/vertx-crud-operations-demo/tree/master/src/main/java/com/vertx/student/crud

0
votes

The two common ways to do that :

  • build a fat jar using the maven shade plugin or exec plugin and the io.vertx.core.Launcher class as main class, according to this documentation. Then you will be able to run your fat jar with a java -jar command.
  • My favorite : use the vertx command line (like you would do with nodejs for example).

I'd prefer the second solution in order to avoid the duplication of the vert.x core library in your filesystem which can have a real cost when you have to run bunch of vert.x microservices.

Afterwards to go further you can encapsulate that with a resilient services orchestrator like systemd or even docker+kubernetes & co.

-1
votes

You can use main() very easily:

public class Application {
    public static void main(String args[]) {
        Vertx vertx = Vertx.vertx()
        vertx.deployVerticle(new MainVerticle());
    }
}