Chapter 2. Configuring your applications

This section explains how to configure your applications to work with Eclipse Vert.x runtime.

2.1. Configuring your application to use Eclipse Vert.x

When you start configuring your applications to use Eclipse Vert.x, you must reference the Eclipse Vert.x BOM (Bill of Materials) artifact in the pom.xml file at the root directory of your application. The BOM is used to set the correct versions of the artifacts.

Prerequisites

  • A Maven-based application

Procedure

  1. Open the pom.xml file, add the io.vertx:vertx-dependencies artifact to the <dependencyManagement> section. Specify the type as pom and scope as import.

    <project>
      ...
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>io.vertx</groupId>
            <artifactId>vertx-dependencies</artifactId>
            <version>${vertx.version}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      ...
    </project>
  2. Include the following properties to track the version of Eclipse Vert.x and the Eclipse Vert.x Maven Plugin you are using.

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

    <project>
      ...
      <properties>
        <vertx.version>${vertx.version}</vertx.version>
        <vertx-maven-plugin.version>${vertx-maven-plugin.version}</vertx-maven-plugin.version>
      </properties>
      ...
    </project>
  3. Specify vertx-maven-plugin as the plugin used to package your application:

    <project>
      ...
      <build>
        <plugins>
            ...
            <plugin>
                <groupId>io.reactiverse</groupId>
                <artifactId>vertx-maven-plugin</artifactId>
                <version>${vertx-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>vmp</id>
                        <goals>
                            <goal>initialize</goal>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <redeploy>true</redeploy>
                </configuration>
            </plugin>
            ...
        </plugins>
      </build>
      ...
    </project>
  4. Include repositories and pluginRepositories to specify the repositories that contain the artifacts and plugins to build your application:

    <project>
    ...
      <repositories>
        <repository>
          <id>redhat-ga</id>
          <name>Red Hat GA Repository</name>
          <url>https://maven.repository.redhat.com/ga/</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>redhat-ga</id>
          <name>Red Hat GA Repository</name>
          <url>https://maven.repository.redhat.com/ga/</url>
        </pluginRepository>
      </pluginRepositories>
    ...
    </project>

Additional resources

  • For more information about packaging your Eclipse Vert.x application, see the Vert.x Maven Plugin documentation.