Gradle Glossary

Introduction

Navigate the landscape of project automation and dependency management with Gradle.

Understanding key terms is essential for successful project building. Explore our Gradle Glossary for clear definitions on project automation, dependency management, and building efficiency. Enhance your understanding effortlessly and optimize your project workflows.

Gradle Terms

A

Artifact: In the context of publishing, "artifact" refers to a file with a unique classifier and extension. In Maven coordinates, "artifactId" represents a group of such artifacts, like "okhttp" which includes jar, sources, and javadocs.

B

Build: A "build" in Gradle refers to the collective execution of individual tasks that make up the build process. A build is composed of projects, and each project contains a set of tasks. Typically, a build results in either a "SUCCESS" or "FAILURE" outcome. To initiate a build, you can use either the gradle or gradlew command.

Build script: A build.gradle script is a crucial component in defining a Gradle module. The presence of this script, accompanied by an entry in the settings script (except for the root build script, which does not require an entry), is what establishes a Gradle module.

C

Configuration: In the context of Gradle, a Configuration is essentially a collection of dependencies, with the most commonly used configurations being api and implementation. For a more comprehensive understanding of configurations, it is recommended to consult the documentation for the java-library plugin. While the use of configurations as a container for dependencies is the most prevalent among Gradle users, plugin authors can also utilize configurations in alternative ways, such as serving as a FileCollection for task inputs or as an outgoing variant for later publication. The term configuration is widely used and overloaded in the Gradle world, reflecting its versatility and importance in the build system.

Configuration phase: A Gradle build consists of two main stages: the configuration phase, which should not be mistaken for Configuration instances, and the execution phase. The configuration phase is the initial stage, and it is executed in a single-threaded manner.

Convention plugin: A Plugin that is constructed on top of an ecosystem plugin and applies standard conventions to the build script that employs the Plugin.

E

Ecosystem plugin: A Plugin that is tasked with constructing a programming language, such as Java (java and java-library), Groovy, Scala, Android, Kotlin, and others. Numerous Plugins are managed by Gradle and form an integral part of the Gradle distribution.

Execution phase: During the execution phase of a Gradle build, which follows the completion of the configuration phase, all task actions are executed. This phase features multiple levels of parallelism, allowing for efficient and concurrent execution of tasks.

G

Gradle: Gradle is an open-source build system that is developed and supported by Gradle, Inc., a company operating with a profit-driven model.

I

Init script: An init script, also known as an initialization script, is supported by an instance of the Gradle type. This implies that the script is executed in the context of a Gradle instance, allowing it to access and modify the build environment.

M

Maven (build tool): Maven is a build tool similar to Gradle, but it employs a more declarative syntax based on XML for defining build configurations. When it comes to publishing dependencies, Maven utilizes the Maven publication format, which is a standardized format for packaging and sharing dependencies across different projects and systems.

Maven (publication format): The Maven publication format is widely used in the JVM ecosystem for publishing and consuming binary dependencies. Each dependency is identified by a unique string known as "Maven coordinates", which consists of three parts: group, artifact, and version- "$group:$artifact:$version. These dependencies can be accessed and retrieved by specifying the URL path as $root/$group/$version. For example, the files for the dependency com.squareup.okhttp3:okhttp:4.9.3 can be found at https://repo.maven.apache.org/maven2/com/squareup/okhttp3/okhttp/4.9.3/. Although the Maven publication format was initially developed for the Maven build tool, Gradle also supports it to ensure compatibility and flexibility. To provide additional information about the dependencies beyond what's available in a standard pom file, Gradle has introduced its own module metadata format.

MavenCentral: MavenCentral serves as the central repository for hosting Maven publications and is maintained by Sonatype. It is the default repository for many projects within the ecosystem, alongside other repositories like the discontinued jcenter and the Google Maven repository.

Module: The term "module" is a commonly used informal term for a Project in Gradle, surpassing the formal designation. A module typically refers to a directory containing source code that functions somewhat autonomously within a multi-module or multi-project setup. This term, like "Project", is heavily utilized in various contexts within the Gradle ecosystem.

P

Plugin: At its core, Gradle operates on a plugin framework. The foundation of Gradle consists mainly of essential infrastructure elements like a sophisticated dependency resolution engine that caters to all project types. The additional features and capabilities of Gradle are provided by a variety of plugins, encompassing core plugins integrated within Gradle, third-party plugins, and custom script plugins specific to individual builds. There are three types of plugins categorized by the context of their application:

  1. Project plugins, which implement Plugin<Project> and are utilized in build scripts.
  2. Settings plugins, which implement Plugin<Settings> and are employed in settings scripts.
  3. Init (Gradle) plugins, which implement Plugin<Gradle> and are utilized in init scripts.

Precompiled script plugin: Similar to a plugin, precompiled script plugins are designed to resemble build scripts. These script plugins can be authored in Groovy or Kotlin by applying the groovy-gradle-plugin or kotlin-dsl plugin, respectively.

Project: The term "module" is frequently used to refer to a Gradle project, which is supported by a Project instance, hence the name. Among the various types of plugins, the project plugin is the most prevalent. Gradle projects often consist of multiple projects, which are sometimes referred to as "subprojects".

Publication: A Gradle Publication typically encompasses a collection of artifacts along with potential metadata. In most cases, you will work with MavenPublications when publishing in the Maven publication format using the maven-publish plugin.

S

Script plugin: A Gradle script can serve as a reusable component that can be incorporated into other Gradle scripts, such as build scripts, settings scripts, and init scripts. These scripts can be written in either Groovy or Kotlin and are integrated into other scripts through the PluginAware.apply method. For instance, you can apply a script with the syntax apply from: 'complicated_thing.gradle'. Depending on the type of script to which they are applied, these scripts are supported by either a Project instance, a Settings instance, or a Gradle instance.

Settings script: A settings.gradle script serves as a configuration file for a Gradle build. Among its various responsibilities, one of the most critical is specifying the collection of projects that constitute the build, which is achieved through the use of directives like include ':project1'.

SoftwareComponent: A SoftwareComponent in Gradle represents a compilation of artifacts generated during the build process. This API, introduced relatively recently, facilitates the linkage between outgoing configurations and publications. Typically, existing components like java or android are utilized to configure Maven publications. However, if you are developing a plugin, you may find yourself working with AdhocComponentWithVariants.

T

Task: A Gradle project is composed of one or more tasks, each of which should ideally be atomic, with defined inputs and outputs. Gradle executes these tasks to carry out its functions, with examples including compiling source code, generating artifacts like jars or apks, producing Javadoc, executing static analysis tools like lint, removing temporary files, or publishing to a repository. When a Gradle task is executed, the outcome is observable and can be one of the following: EXECUTED, SKIPPED, FAILED, FROM-CACHE, UP-TO-DATE, NO-SOURCE, or a blank status indicating that the task was executed.

Guide to Install Gradle

Ready to dive into using Gradle? Ensure you have it installed correctly by following these detailed installation guides tailored to different distros.

With these installation guides, you'll be up and running with Gradle in no time!