The following glossary helps you understand Gradle terminology.
A
- Artifact
-
A file or directory produced by a build, such as a JAR, a ZIP distribution, or a native executable.
Artifacts are typically designed to be used or consumed by users and other projects or deployed to hosting systems. In such cases, the artifact is a single file. Directories are common in the case of inter-project dependencies to avoid the cost of producing the publishable artifact.
B
- Build Scan
-
A Build Scan is a service provided by Gradle which is used to identify build issues and build performance.
- Build Script
-
A
build.gradlescript.The existence of a build script, along with an entry in the settings script (other than for the root build script, which requires no entry), is what defines a Gradle module.
C
- Capability
-
A capability identifies a feature offered by one or multiple components. A capability is identified by coordinates similar to the coordinates used for module versions. By default, each module version offers a capability that matches its coordinates, such as
com.google:guava:18.0. Capabilities can be used to express that a component provides multiple feature variants or that two different components implement the same feature (and thus cannot be used together). For more details, see the section on capabilities.
- Component
-
Any single version of a module.
For external libraries, the term component refers to one published library version.
In a build, components are defined by plugins (e.g., the Java Library plugin) and provide a simple way to define a publication for publishing. They comprise artifacts as well as the appropriate metadata that describes a component’s variants in detail. For example, the
javacomponent in its default setup consists of a JAR — produced by thejartask — and the dependency information of the Java api and runtime variants. It may also define additional variants, for example, sources and Javadoc, with the corresponding artifacts. - Component Metadata Rule
-
A component metadata rule is a rule that modifies a component’s metadata after it is fetched from a repository, e.g., to add missing information or correct incorrect information. In contrast to resolution rules, component metadata rules are applied before resolution starts. Component metadata rules are defined as part of the build logic and can be shared through plugins. For more information, see the section on fixing metadata with component metadata rules.
- Configuration
-
A configuration is a named set of dependencies grouped together for a specific goal. Configurations provide access to the underlying, resolved modules and their artifacts. For more information, see the sections on dependency configurations as well as resolvable and consumable configurations.
The word "configuration" is an overloaded term that has a different meaning outside of dependency management.
- Configuration Phase
-
A Gradle build is composed of two primary phases, the configuration phase (not to be confused with [sub:terminology_configuration] instances) and the execution phase.
The configuration phase happens first and is single-threaded.
- Convention Plugin
-
A plugin built on top of an ecosystem plugin, which applies common conventions to the build script that uses the plugin.
- Cross-Configuration
- Cross-Project Configuration
-
Cross-project configuration refers to managing and customizing multiple subprojects within a multi-project build.
It allows you to define common settings, dependencies, and tasks in a shared
build.gradle(.kts)orsettings.gradle.(kts)file, typically located in the root project:build.gradlesubprojects { apply plugin: 'java' repositories { mavenCentral() } dependencies { testImplementation 'junit:junit:4.13.2' } }Cross-project configuration usually breaks Project Isolation, and Parallel Project Execution, so you should use convention plugins or the proper APIs whenever possible:
build.gradlegradle.lifecycle.beforeProject { repositories { mavenCentral() } }The following example of cross-project configuration should always be avoided:
subprojectA/build.gradletasks.register("customTask") { // Avoid this! Directly accessing outputs from another subproject's task def outputFile = project(":subprojectB").tasks.named("someTask").get().outputs.files.singleFile inputs.file(outputFile) doLast { println("Processing file from subprojectB: ${outputFile}") } }subprojectB/build.gradletasks.register("someTask") { def outputFile = layout.buildDirectory.file("output.txt") outputs.file(outputFile) doLast { outputFile.get().asFile.text = "Output from subprojectB" println("Generated output file in subprojectB: ${outputFile.get().asFile}") } }This tightly couples
subprojectAtosubprojectB, breaking modularity and creating potential issues during parallel builds or configuration caching.
D
- Dependency
-
A dependency is a pointer to another piece of software required to build, test, or run a module. For more information, see the section on declaring dependencies.
- Dependency Constraint
-
A dependency constraint defines requirements that need to be met by a module to make it a valid resolution result for the dependency. For example, a dependency constraint can narrow down the set of supported module versions. Dependency constraints can be used to express such requirements for transitive dependencies. For more information, see the sections on upgrading and downgrading transitive dependencies.
E
- Eager
-
Many Gradle APIs come in two forms:
eagerandlazy. The difference lies in when values are calculated or resolved.Eager means immediate. Values are evaluated right away during the configuration phase. This can lead to unnecessary work, especially in large builds. It’s more prone to performance issues.
build.gradle.kts// Eager: evaluated as soon as the build script runs val myValue = file("output.txt") // Lazy: evaluated only when required val myValue = layout.buildDirectory.file("output.txt")
- Ecosystem Plugin
-
A plugin responsible for building a language, such as Java (
javaandjava-library), Groovy, Scala, Android, Kotlin, etc. Many plugins are maintained by Gradle and are part of the Gradle distribution.
- Execution phase
-
The second primary phase of a Gradle build, the execution phase happens after the configuration phase is complete. This is where all tasks actions are executed.
This phase has multiple levels of parallelism.
F
- Feature Variant
-
A feature variant is a variant representing a feature of a component that can be individually selected or not. A feature variant is identified by one or more capabilities. For more information, see the sections on modeling feature variants, and optional dependencies.
G
- Gradle Build
-
A Gradle build can consist of one or more Gradle projects and is typically configured using a
settings.gradle(.kts)file at the root.When invoked, the Gradle build executes a set of tasks based on the defined build logic, often using the Gradle Wrapper (
./gradlew).
I
- Incremental Builds
-
An incremental build executes only the tasks that are necessary. If we run any source code, Gradle first checks if that source code has gone through any previous execution. If the code has some changes, it will then be executed, but if there are no changes, then it will skip the execution of that code.
- Init Script
-
An init or initialization script, is backed by an instance of the
Gradletype.
L
- Lazy
-
Many Gradle APIs come in two forms:
eagerandlazy. The difference lies in when values are calculated or resolved.Lazy means deferred. Values are deferred until they’re actually needed, usually during the execution phase. This is more efficient and supports things like configuration caching and up-to-date checking.
build.gradle.kts// Lazy: evaluated only when required val myValue = layout.buildDirectory.file("output.txt") // Eager: evaluated as soon as the build script runs val myValue = file("output.txt")
M
- MavenCentral
-
MavenCentral is the main repository that hosts Maven publications. It is operated by a company named Sonatype and is the default repository for a lot of the ecosystem.
Many other repositories exists like (the now defunct) jcenter or the Google Maven repository.
- Module
-
A piece of software that evolves over time e.g., Google Guava. Every module has a name. Each module release is optimally represented by a module version. For convenient consumption, modules can be hosted in a repository.
- Module Metadata
-
Releases of a module provide metadata. Metadata is the data that describes the module in more detail, e.g., information about the location of artifacts or required transitive dependencies. Gradle offers its own metadata format called Gradle Module Metadata (
.modulefile) but also supports Maven (.pom) and Ivy (ivy.xml) metadata. See the section on understanding Gradle Module Metadata for more information on the supported metadata formats.
- Module version
-
A module version represents a distinct set of changes of a released module. For example,
18.0represents the module version with the coordinatescom.google:guava:18.0. In practice, there are no limitations to the scheme of the module version. Timestamps, numbers, and special suffixes like-GAare all allowed identifiers. The most widely-used versioning strategy is semantic versioning.
P
- Platform
-
A platform is a set of modules aimed to be used together. There are different categories of platforms corresponding to different use cases:
-
module set: often a set of modules published together as a whole. Using one module of the set often means we want to use the same version for all modules of the set. For example, if using
groovy1.2, also usegroovy-json1.2. -
runtime environment: a set of libraries known to work well together, such as the Spring Platform, which recommends versions for both Spring and components that work well with Spring.
-
deployment environment: Java runtime, application server, etc …
In addition, Gradle defines virtual platforms.
Maven’s BOM (bill-of-material) is a popular platform that Gradle supports.
-
- Plugin
-
Gradle is built on a plugin system. Gradle itself is primarily composed of infrastructure, such as a sophisticated dependency resolution engine, common to all project types. The rest of its functionality comes from plugins, including "core" plugins distributed with Gradle itself, third-party plugins, and script plugins in a given build.
There are three kinds of plugin, based on the context in which they are applied:
-
Project plugins that implement
Plugin<Project>, applied in build scripts. -
Settings plugins that implement
Plugin<Settings>, applied in settings scripts. -
Init (Gradle) plugins that implement
Plugin<Gradle>, applied in init scripts.
Plugins may be implemented as so-called binary plugins (that is, by explicitly implementing one of the specific generic interfaces described above), or as precompiled script plugins. This distinction is merely an implementation detail.
- Precompiled Script Plugin
-
Equivalent to a plugin, but written such that it looks like a build script, precompiled script plugins can be written in Groovy or Kotlin by applying the
groovy-gradle-pluginorkotlin-dslplugin, respectively.
- Project
-
Often referred to as a "module", every Gradle project is backed by a
Projectinstance, hence the name.Most Gradle projects are composed of many projects (usually called "subprojects").
- Publication
-
A description of the files and metadata that should be published to a repository as a single entity for use by consumers.
A publication has a name and consists of one or more artifacts plus information about those artifacts (the metadata).