Book Image

Gradle Dependency Management

By : Hubert Klein Ikkink
Book Image

Gradle Dependency Management

By: Hubert Klein Ikkink

Overview of this book

Table of Contents (14 chapters)
Gradle Dependency Management
About the Author
About the Reviewers

Understanding the dependency cache

The dependency cache of Gradle tries to minimize the number of remote requests and downloads so that builds can be fast and reliable. The cache has two parts to perform proper dependency caching:

  • First, it has a cache for dependency metadata (POM or Ivy descriptor files) for a dependency group, name, and version. Gradle keeps a separate cache for each repository. So, if the same dependency is found in multiple repositories, then the metadata information is cached in multiple dependency metadata caches.

  • The dependency cache also has a single cache with downloaded artifacts for the dependencies. The multiple metadata caches share the same cache for downloaded artifacts. The artifacts are stored by the SHA1 hash code of their contents and not by metadata, such as group, name, or version.

The separation of a metadata cache based on the repository and the artifact cache provides enough flexibility to perform repeatable and reliable dependency resolution. If the...