Skip to content

Latest commit

 

History

History
 
 

maven-verticle

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Vert.x 3.0 Simple Maven Verticle project

This project is very similar to the maven-simplest project but instead of embedding Vert.x it shows an example of writing the code as a verticle.

You can run it directly in your IDE by creating a run configuration that uses the main class io.vertx.core.Starter and passes in the arguments run io.vertx.example.HelloWorldVerticle.

The pom.xml uses the Maven shade plugin to assemble the application and all it’s dependencies into a single "fat" jar.

To build a "fat jar"

mvn package

To run the fat jar:

java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar

(You can take that jar and run it anywhere there is a Java 8+ JDK. It contains all the dependencies it needs so you don’t need to install Vert.x on the target machine).

Now point your browser at http://localhost:8080

Writing code in verticles allow you to scale it more easily, e.g. let’s say you have 8 cores on your server and you want to utilise them all, you can deploy 8 instances as follows:

java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar -instances 8

You can also enable clustering and ha at the command line, e.g.

java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar -cluster
java -jar target/maven-verticle-3.0.0-SNAPSHOT-fat.jar -ha

Please see the docs for a full list of Vert.x command line options.