This project is very similar to the maven-verticle project but instead of using a Java verticle is uses a Groovy verticle.
To create a correct fatjar for Groovy, the GroovyResourceTransformer
(available since the 3.0.0 version of the plugin)
must be used:
<transformer implementation="org.apache.maven.plugins.shade.resource.GroovyResourceTransformer"> </transformer>
You can run it directly in your IDE by creating a run configuration that uses the main class io.vertx.core.Launcher
and passes in the arguments run src/main/groovy/MyGroovyVerticle
.
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-groovy-3.4.1-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
You can also launch the application from Maven directly:
-
to run it using the classes form target/classes:
mvn compile exec:java@run
-
to run the fat jar:
mvn package exec:exec@run-app