Chapter 8. Creating a Quarkus Maven project using code.quarkus.redhat.com

As an application developer, you can use code.quarkus.redhat.com to generate a Quarkus Maven project and automatically add and configure the extensions that you want to use in your application. In addition, code.quarkus.redhat.com automatically manages the configuration parameters required to compile your project into a native executable.

This section walks you through the process of generating a Quarkus Maven project including:

  • Specifying basic details about your application.
  • Choosing the extensions that you want to include in your project.
  • Generating a downloadable archive with your project files.
  • Using the custom commands for compiling and starting your application.

Prerequisites

  • Have a web browser.

Procedure

  1. Navigate to https://code.quarkus.redhat.com using a web browser.
  2. Specify basic details about your project:

    1. Enter a group name for your project. The format of the name follows the Java package naming convention, for example, org.acme.
    2. Enter a name that you want to use for Maven artifacts generated from your project, for example code-with-quarkus.
    3. Select the build tool that you want to use to compile and start your application. The build tool that you choose determines:

      • the directory structure of your generated project.
      • the format of configuration files used in your generated project.
      • the custom build script and command for compiling and starting your application that code.quarkus.redhat.com displays for you after you generate your project.

        Note

        Red Hat provides support for using code.quarkus.redhat.com to create Quarkus Maven projects only. Generating Gradle projects is not supported by Red Hat.

        Screenshot of the basic application details section on the code.quarkus.redhat.com site
  3. Specify additional details about your application project:

    1. Select Configure more options to display the fields that contain additional application details.
    2. Enter a version that is used in artifacts generated from your project. The default value of this field is 1.0.0-SNAPSHOT. Using semantic versioning is recommended, but you can use a different type of versioning, if you prefer.
    3. Select whether you want code.quarkus.redhat.com to add example code to your project. When you add extensions that are marked with the example code icon to your project from the list of extensions, you can enable this option to automatically create example class files and resource files for those extensions when you generate your project. When you do not add any extensions that provide example code, this option does not affect your generated project.

      Screenshot of the application details section on the code.quarkus.redhat.com site showing the extended form with additional application details
      Note

      code.quarkus.redhat.com automatically uses the latest release of Red Hat build of Quarkus. You can manually change the BOM version in the pom.xml file after you generate your project.

  4. Select the extensions that you want to use in your application from the list of extensions. The selected extensions are included as dependencies of your Quarkus application with their versions being managed by the Quarkus platform to ensure their compatibility.

    You can enable the option to automatically generate example code for extensions that are marked with the example code icon.

    Screenshot of the list of extensions at the code.quarkus.redhat.com site that you can add to your project

    Note, that Red Hat provides different levels of support for individual extensions on the list, which are indicated by labels next to the name of each extension:

    • SUPPORTED extensions are fully supported by Red Hat for use in enterprise application in production environments.
    • TECH-PREVIEW extensions are subject to limited support by Red Hat in production environments under the Technology Preview Features Support Scope.
    • DEV-SUPPORT extensions are not supported by Red Hat for use in production environments, but the core functionalities that they provide are supported by Red Hat developers for use in developing new applications.
    • Unlabeled extensions are not supported by Red Hat for use in production environments.
    • DEPRECATED extension are planned to be replaced by a newer technology or implementation that provides the same functionality.

      You can expand the overflow menu (⋮) next to each of the extensions to access additional options that you can use to:

      • add the extension to an existing project using the Quarkus maven plugin on the command line.
      • copy an XML snippet to add the the extension to the pom.xml file of a project.
      • obtain the groupId, artifactId and version of each extension.
      • open the extension guide.

        Screenshot of an expanded overflow menu next to one of the extensions on code.quarkus.redhat.coim showing the custom commands that you can copy

  5. Select Generate your application to confirm your choices and display the overlay screen with the download link for the archive that contains your generated project. The overlay screen also shows the custom command that you can use to compile and start your application.
  6. Select Download the ZIP to save the archive with the generated project files to your machine.
  7. Extract the contents of the archive.
  8. Navigate to the directory that contains your extracted project files:

    cd <directory_name>
  9. Compile and start your application in development mode:

    ./mvnw compile quarkus:dev