Menu Close
Settings Close

Language and Page Formatting Options

Chapter 3. Creating an Eclipse Vert.x project with a POM file

When you develop a basic Eclipse Vert.x application, you should create the following artifacts. We will create these artifacts in our first getting-started Eclipse Vert.x project.

  • A Java class containing Eclipse Vert.x methods.
  • A pom.xml file containing information required by Maven to build the application.

The following procedure creates a simple Greeting application that returns Greetings! as response.


Eclipse Vert.x supports builder images based on OpenJDK 8 and OpenJDK 11 for building and deploying your applications to OpenShift. Oracle JDK and OpenJDK 9 builder images are not supported.


  • OpenJDK 8 or OpenJDK 11 is installed.
  • Maven is installed.


  1. Create a new directory getting-started, and navigate to it.

    $ mkdir getting-started
    $ cd getting-started

    This is the root directory for the application.

  2. Create a directory structure src/main/java/com/example/ in the root directory, and navigate to it.

    $ mkdir -p src/main/java/com/example/
    $ cd src/main/java/com/example/
  3. Create a Java class file containing the application code.

    package com.example;
    import io.vertx.core.AbstractVerticle;
    import io.vertx.core.Promise;
    public class MyApp extends AbstractVerticle {
        public void start(Promise<Void> promise) {
                .requestHandler(r ->
                .listen(8080, result -> {
                    if (result.succeeded()) {
                    } else {

    The application starts an HTTP Server on port 8080. When you send a re­quest, it re­turns Greetings! mes­sage.

  4. Create a pom.xml file in the application root directory getting-started with the following content:

    • In the <dependencyManagement> section, add the io.vertx:vertx-dependencies artifact.
    • Specify the type as pom and scope as import.
    • In the <project> section, under <properties>, specify the versions of Eclipse Vert.x and the Eclipse Vert.x Maven Plugin.


      Properties can be used to set values that change in every release. For example, versions of product or plugins.

    • In the <project> section, under <plugin>, specify vertx-maven-plugin. The Eclipse Vert.x Maven Plugin is used to package your application.
    • Include repositories and pluginRepositories to specify the repositories that contain the artifacts and plugins to build your application.

      The pom.xml contains the following artifacts:

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="" xmlns:xsi=""
      <name>My Application</name>
      <description>Example application using Vert.x</description>
      <!-- Import dependencies from the Vert.x BOM. -->
      <!-- Specify the Vert.x artifacts that your application depends on. -->
        <!-- Test dependencies -->
      <!-- Specify the repositories containing Vert.x artifacts. -->
          <name>Red Hat GA Repository</name>
    <!-- Specify the version of the Maven Surefire plugin. -->
    <!-- Configure your application to be packaged using the Vert.x Maven Plugin. -->
  5. Build the application using Maven from the root directory of the application.

    mvn vertx:run
  6. Verify that the application is running.

    Use curl or your browser to verify if your application is running at http://localhost:8080 and returns "Greetings!" as response.

    $ curl http://localhost:8080