Wielding the Quarkus CLI: Why Java Developers Should Embrace This Command-Line Power Tool
Simplify your Quarkus development, boost productivity, and free yourself from Maven vs. Gradle complexity with one unified CLI.
Command-line interfaces are an essential part of every developer’s toolbox, and the Quarkus CLI is no exception. But is there really any benefit to using it over traditional build tools like Maven or Gradle?
Let’s explore.
What is the Quarkus CLI?
At its core, the Quarkus CLI is a convenient wrapper around the Quarkus Maven or Gradle plugins. It offers a streamlined developer experience for a wide range of tasks, including:
Creating new Quarkus projects
Managing extensions
Running and testing applications
Building and pushing containers
Deploying to the cloud
Upgrading existing Quarkus applications
Once installed (see instructions below), you can invoke the CLI from any terminal using the quarkus
command:
$ quarkus
Quarkus CLI version 3.24.2
Create Quarkus projects with Maven, Gradle, or JBang.
Manage extensions and source registries.
Create: quarkus create
Iterate: quarkus dev
Build and test: quarkus build
Find more information at https://quarkus.io
If you have questions, check https://github.com/quarkusio/quarkus/discussions
Usage: quarkus [-ehv] [--refresh] [--verbose] [--config=CONFIG]
[-D=<String=String>]... [COMMAND]
...
But what makes this worth using instead of the Maven or Gradle plugins directly?
To CLI or Not to CLI?
The primary advantage of the Quarkus CLI is that it abstracts away the underlying build system. Whether your project uses Maven or Gradle, the CLI commands behave consistently.
For example, to add the REST extension, you can simply run:
$ quarkus ext add rest
Behind the scenes, the CLI translates this into the correct command based on your project’s build tool:
# Maven
$ ./mvnw quarkus:add-extension -Dextension=rest
# Gradle
$ ./gradlew addExtension --extensions="rest"
Conciseness and Shortcuts
Would you rather type this:
$ ./mvnw quarkus:list-extensions -Dall=false -Dcategory="messaging" -Dquarkus.platform.version="3.20.0" -DsearchPattern="kafka" -Dformat=full
Or this:
$ quarkus ext ls -i -P 3.20.0 -c "messaging" -s "kafka" --full
Using the CLI, you don’t need to memorize or hunt down Maven plugin parameters like quarkus:list-extensions
or their exact casing and syntax. With Maven, discovering these parameters often requires extra steps, like running:
$ ./mvnw quarkus:help -Ddetail -Dgoal=list-extensions
With the CLI, everything is discoverable and autocomplete-friendly.
Autocompletion Magic
Is it quarkusAddExtension
or addExtension
? --extension
or --extensions
? The CLI eliminates this guessing game.
The Quarkus CLI includes autocompletion support out of the box. You can activate it by running:
$ source <(quarkus completion)
From there, your shell will offer tab-completion for commands and options:
$ quarkus ext ls -[press TAB here]
-B --errors --platform-bom
--batch-mode --full --refresh
-c -h --registry-client
--category --help -s
--concise -i -S
--config --id --search
-D --installable --stream
--dry-run --origins --verbose
-e -P
This can save minutes of context switching, browser searches, and trial-and-error.
Creating New Quarkus Projects
Creating a new Quarkus application is also simple with the CLI:
$ quarkus create app org.acme:quarkus-cli-rocks
Sure, you could use the graphical generator at code.quarkus.io or manually run a Maven command. But keep in mind: using the Maven plugin requires a Maven installation, or the use of the Maven wrapper.
The CLI handles this for you. It manages the setup, downloads dependencies, and configures everything.
And while there's no Gradle equivalent to the Maven archetype, you can create a Gradle-based project using the CLI by adding:
--gradle
to your create
command.
How to Install the Quarkus CLI
You’ll find full installation instructions at quarkus.io/guides/cli-tooling, but the basics are:
# On Unix-based systems
$ sdk install quarkus
# On Windows
PS C:\> choco install quarkus
Verify your installation:
$ quarkus --version
3.24.2
Final Thoughts
The Quarkus CLI isn’t black magic. It isn’t a superpower. It’s a developer-friendly tool designed to make your daily Quarkus interactions faster, cleaner, and easier.
Is it required? Not at all.
But if you find yourself jumping between Maven and Gradle, or just want a more streamlined experience, the CLI might just become your favorite weapon on the Quarkus journey.
Now it’s your turn: Will you wield the CLI or stick with your traditional tools?