Chapter 6. Installing and managing Java extensions with Quarkus applications

You can use Java extensions to expand the functionality of your application and to configure, boot, and integrate a framework into your application. This procedure shows you how to find and add extensions to your Quarkus project.

Prerequisites

  • You have a Quarkus Maven project.

Procedure

  1. Navigate to your Quarkus project directory.
  2. To list the available extensions, enter the following command:

    ./mvnw quarkus:list-extensions
  3. To add an extension to your project, enter the following command where EXTENSION is the group, artifact, version (GAV) of the extension that you want to add:

    ./mvnw quarkus:add-extension -Dextensions="EXTENSION"

    For example, to add the Agroal extension, enter the following command:

    ./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-agroal"
  4. To search for a specific extension, enter the extension name or partial name after -Dextensions=. The following example searches for extensions that contain the text jdbc, agroal, and non-exist-ent in the name:

    ./mvnw quarkus:add-extension -Dextensions=jdbc,agroal,non-exist-ent

    This command returns the following result:

    ❌ Multiple extensions matching 'jdbc'
        * io.quarkus:quarkus-jdbc-h2
        * io.quarkus:quarkus-jdbc-mariadb
        * io.quarkus:quarkus-jdbc-postgresql
        Be more specific e.g using the exact name or the full gav.
    ✅ Adding extension io.quarkus:quarkus-agroal
    ❌ Cannot find a dependency matching 'non-exist-ent', maybe a typo?
    [...]
  5. To install all extensions that a specific text string returns, enter the extension name or partial name after -Dextensions=. The following example searches for and installs all extensions that begin with hibernate-:

    ./mvnw quarkus:add-extension -Dextensions="hibernate-*"