The Gradle command-line interface

Gradle, just like other build tools, is primarily run from a command line. That's why it is worth spending some time to get familiar with its command-line interface. Typically, a gradle command is issued from the root of a project directory with some tasks to be executed. Let's say we are in the hello-gradle directory, which is currently empty.

Gradle provides a very simple command-line interface (CLI), which takes the following form:

gradle [options…] [tasks…]

As we can see, apart from the gradle command itself, everything else is optional. The options tweak the execution of the Gradle whereas tasks, which we will see in detail later, are the basic units of work. Options are common across all projects and are ...

Get Gradle Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.