Chapter 5. Other ways to create Eclipse Vert.x projects This section shows the different ways in which you can create Eclipse Vert.x projects. 5.1. Creating a Eclipse Vert.x project on the command line You can use the Eclipse Vert.x Maven plug-in on the command line to create a Eclipse Vert.x project. You can specify the attributes and values on the command line. Prerequisites OpenJDK 8 or OpenJDK 11 is installed. Maven 3 or higher is installed. A text ed\u00adi\u00adtor or IDE is available. Curl or HTTPie or a browser to per\u00adform HTTP re\u00adquests is available. Procedure In a command terminal, enter the following command to verify that Maven is using OpenJDK 8 or OpenJDK 11 and the Maven version is 3.6.0 or higher: mvn --version If the preceding command does not return OpenJDK 8 or OpenJDK 11, add the path to OpenJDK 8 or OpenJDK 11 to the PATH environment variable and enter the command again. Create a directory and go to the directory location. Use the following command to create a new project using the Eclipse Vert.x Maven plug-in. mvn io.reactiverse:vertx-maven-plugin:USD{vertx-maven-plugin-version}:setup -DvertxBom=vertx-dependencies \ -DvertxVersion=USD{vertx_version} \ -DprojectGroupId= USD{project_group_id} \ -DprojectArtifactId= USD{project_artifact_id} \ -DprojectVersion=USD{project-version} \ -Dverticle=USD{verticle_class} \ -Ddependencies=USD{dependency_names} The following example shows you how you can create an Eclipse Vert.x application using the command explained. mvn io.reactiverse:vertx-maven-plugin:1.0.24:setup -DvertxBom=vertx-dependencies \ -DvertxVersion=4.3.7.redhat-00002 \ -DprojectGroupId=io.vertx.myapp \ -DprojectArtifactId=my-new-project \ -DprojectVersion=1.0-SNAPSHOT \ -DvertxVersion=4.3.7.redhat-00002 \ -Dverticle=io.vertx.myapp.MainVerticle \ -Ddependencies=web The following table lists the attributes that you can define with the setup command: Attribute Default Value Description vertx_version The version of Eclipse Vert.x. The version of Eclipse Vert.x you want to use in your project. project_group_id io.vertx.example A unique identifier of your project. project_artifact_id my-vertx-project The name of your project and your project directory. If you do not specify the project_artifact_id , the Maven plug-in starts the interactive mode. If the directory already exists, the generation fails. project-version 1.0-SNAPSHOT The version of your project. verticle_class io.vertx.example.MainVerticle The new verticle class file created by the verticle parameter. dependency_names Optional parameter The list of dependencies you want to add to your project separated by comma. You can also use the following syntax to configure the dependencies: groupId:artifactId:version:classifier For example: - To inherit the version from BOM use the following syntax: io.vertx:vertxcodetrans - To specify dependency use the following syntax: commons-io:commons-io:2.5 - To specify dependency with a classifier use the following syntax: io.vertx:vertx-template-engines:3.4.1:shaded The command creates an empty Eclipse Vert.x project with the following artifacts in the getting-started directory: The Maven build de\u00adscrip\u00adtor pom.xml con\u00adfig\u00adured to build and run your ap\u00adpli\u00adca\u00adtion Example verticle in the src/main/java folder In the pom.xml file, specify the repositories that contain the Eclipse Vert.x artifacts to build your application. Alternatively, you can configure the Maven repository to specify the build artifacts in the settings.xml file. See the section Configuring the Apache Maven repository for your Eclipse Vert.x projects , for more information. Use the Eclipse Vert.x project as a template to create your own application. Build the application using Maven from the root directory of the application. mvn package Run the application using Maven from the root directory of the application. mvn vertx:run 5.2. Creating a Eclipse Vert.x project using the community Vert.x starter You can use the community Vert.x starter to create a Eclipse Vert.x project. The starter creates a community project. You will have to convert the community project to a Red Hat build of Eclipse Vert.x project. Prerequisites OpenJDK 8 or OpenJDK 11 is installed. Maven 3 or higher is installed. A text ed\u00adi\u00adtor or IDE is available. Curl or HTTPie or a browser to per\u00adform HTTP re\u00adquests is available. Procedure In a command terminal, enter the following command to verify that Maven is using OpenJDK 8 or OpenJDK 11 and the Maven version is 3.6.0 or higher: mvn --version If the preceding command does not return OpenJDK 8 or OpenJDK 11, add the path to OpenJDK 8 or OpenJDK 11 to the PATH environment variable and enter the command again. Go to Vert.x Starter . Select the Version of Eclipse Vert.x. Select Java as the language. Select Maven as the build tool. Enter a Group Id , which is a unique identifier of your project. For this procedure, keep the default, com.example . Enter an Artifact Id , which is the name of your project and your project directory. For this procedure, keep the default, starter . Specify the dependencies you want to add to your project. For this procedure, add Vert.x Web de\u00adpen\u00addency either by typing it in the De\u00adpen\u00adden\u00adcies text box or select from the list of De\u00adpen\u00adden\u00adcies . Click Advanced options to select the OpenJDK version. For this procedure, keep the default, JDK 11 . Click Gen\u00ader\u00adate Project . The starter.zip file containing the artifacts for Eclipse Vert.x project is downloaded. Create a directory getting-started . Extract the contents of the ZIP file to the getting-started folder. The Vert.x Starter creates an Eclipse Vert.x project with the following artifacts: Maven build de\u00adscrip\u00adtor pom.xml file. The file has configurations to build and run your ap\u00adpli\u00adca\u00adtion. Example verticle in the src/main/java folder. Sam\u00adple test using JUnit 5 in the src/test/java folder. Ed\u00adi\u00adtor con\u00adfig\u00adu\u00adra\u00adtion to en\u00adforce code style. Git con\u00adfig\u00adu\u00adra\u00adtion to ig\u00adnore files. To convert the community project to a Red Hat build of Eclipse Vert.x project, replace the following values in pom.xml file: vertx.version - Specify the Eclipse Vert.x version you want to use. For example, if you want to use Eclipse Vert.x 4.3.7 version, specify the version as 4.3.7.redhat-00002. vertx-stack-depchain - Replace this dependency with vertx-dependencies . Specify the repositories that contain the Eclipse Vert.x artifacts to build your application in the pom.xml file. <repositories> <repository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </repository> </repositories> Alternatively, you can configure the Maven repository to specify the build artifacts in the settings.xml file. See the section Configuring the Apache Maven repository for your Eclipse Vert.x projects , for more information. Use the Eclipse Vert.x project as a template to create your own application. Build the application using Maven from the root directory of the application. mvn package Run the application using Maven from the root directory of the application. mvn exec:java Verify that the application is running. Use curl or your browser to verify if your application is running at http://localhost:8888 and returns "Hello from Vert.x!" as response. USD curl http://localhost:8888 Hello from Vert.x!

Commands:
mvn --version
mkdir getting-started && cd getting-started
mvn io.reactiverse:vertx-maven-plugin:USD{vertx-maven-plugin-version}:setup -DvertxBom=vertx-dependencies -DvertxVersion=USD{vertx_version} -DprojectGroupId= USD{project_group_id} -DprojectArtifactId= USD{project_artifact_id} -DprojectVersion=USD{project-version} -Dverticle=USD{verticle_class} -Ddependencies=USD{dependency_names}
mvn io.reactiverse:vertx-maven-plugin:1.0.24:setup -DvertxBom=vertx-dependencies -DvertxVersion=4.3.7.redhat-00002 -DprojectGroupId=io.vertx.myapp -DprojectArtifactId=my-new-project -DprojectVersion=1.0-SNAPSHOT -DvertxVersion=4.3.7.redhat-00002 -Dverticle=io.vertx.myapp.MainVerticle -Ddependencies=web
<repositories> <repository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </repository> </repositories>
mvn package
mvn vertx:run
mvn --version
<repositories> <repository> <id>redhat-ga</id> <name>Red Hat GA Repository</name> <url>https://maven.repository.redhat.com/ga/</url> </repository> </repositories>
mvn package
mvn exec:java
curl http://localhost:8888 Hello from Vert.x!