This is a very simple example to show how to get goin' with Vert.x (3.4.0.Beta1), Scala (2.12.1) and Gradle (3.4).
It contains two simple ScalaVerticle
written in Scala and based on vertx-lang-scala
:
com.example.Starter
com.example.HttpVerticle
The Starter
will deploy the HttpVerticle
.
And the HttpVerticle
will obviously start a HTTP server running on 8080
by default.
./gradlew run
It's as simple as that. The responsible part in the build.gradle
is also fairly simple:
mainClassName = "io.vertx.core.Launcher"
def mainVerticle = "scala:com.example.Starter"
run {
args = ["run", mainVerticle]
}
This example uses Gradle Shadow to build a fat JAR.
./gradlew jar
... or ./gradlew build
which will also run the jar
task.
The resulting fat JAR will be located at build/libs/vertx3-gradle-scala-fat.jar
.