Extensions

Quarkus has a very active and expanding ecosystem with tons of extensions available. Quarkus is a framework composed of a core and a set of extensions. The core is based on Context and Dependency Injection (CDI). Extensions are usually meant to integrate a third-party framework by exposing their primary components as CDI beans.

A Quarkus extension is simply a module that can run on top of a Quarkus application. The Quarkus application itself is a core module with a set of other extensions.

The most common use case for such an extension is to get a third-party framework running on top of a Quarkus application.

More Information

Maven Mojo create-extension

quarkus:create-extension (prameters)

https://quarkus.io/guides/quarkus-maven-plugin#quarkus-maven-plugin-goal-add-extension-repos
  • artifactId
  • basedir
    • Directory where the changes should be performed. Default: the current directory of the current Java process.
  • extensionId
    • of this extension (REQUIRED). It will be used to generate the different extension modules artifactIds ([namespaceId][extensionId]-parent), runtime ([namespaceId][extensionId]) and deployment ([namespaceId][extensionId]-deployment).
  • extensionName
    • of the runtime module. The extensionNames of the extension parent and deployment modules will be based on this name too. Default: the formatted extensionId
  • groupId
    • The groupId for the newly created Maven modules (REQUIRED – INHERITED IN QUARKUS-CORE).
  • version
    • The version for the newly created Maven modules. Default: automatic in Quarkus Core else io.quarkus.devtools.commands.CreateExtension.DEFAULT_VERSION
  • withoutDevModeTest
    • Indicates whether to generate a devmode test for the extension
  • withoutIntegrationTests
    • Indicates whether to generate an integration tests for the extension
  • withoutTests
    • Indicates whether to generate any tests for the extension (same as -DwithoutUnitTest -DwithoutIntegrationTest -DwithoutDevModeTest)
  • withoutUnitTest
    • Indicates whether to generate a unit test class for the extension

The first way

Create quarkus-first-extension

git clone https://github.com/quarkusio/quarkus.git
cd quarkus
mvn io.quarkus.platform:quarkus-maven-plugin:3.6.4:create-extension -N \
    -DgroupId=zjc.examples \
    -DextensionId=quarkus-first-extension \
    -Dversion=1.0.0-SNAPSHOT \
    -DextensionName="Quarkus First Extension" \
    -DextensionDescription="Do something useful." \
    -DwithoutTests

Output

in quarkus/extensions:

in quarkus/integration-tests:

The second way: Example#1

Create tmp – an empty directory
cd tmp
mvn io.quarkus.platform:quarkus-maven-plugin:3.6.4:create-extension -N \
    -DgroupId=zjc.examples \
    -DextensionId=quarkus-first-extension \
    -Dversion=1.0.0-SNAPSHOT \
    -DextensionName="Quarkus First Extension" \
    -DextensionDescription="Do something useful." \
    -DwithoutTests

In this example we are going to develop the Quarkus First Extension template.

Description and code: http://jreact.com/index.php/2024/01/02/quarkus-first-extension/
On base: Building my first extension