Introducing DPE University — Explore free, self-paced training courses on Gradle and Maven
Logo

Build Cache

Overview

Speed up build times by sharing and reusing unchanged build and test outputs, eliminating time re-building components unaffected by new code changes. Build Cache speeds up local and CI builds by allowing you to share and reuse unchanged build and test outputs across the team. This ensures your build doesn't waste cycle time re-building components that are unaffected by new code changes. Develocity Build Cache supports Gradle and Maven build tools.


A build cache client and local build cache were introduced to the Open Source/Java world by Gradle in 2017 to speed up local feedback cycles for developers that use the Gradle Build Tool. Soon after, Develocity added support for a remote build cache backend. Since 2019, the Develocity Maven extension has provided a complete Build Cache solution for Maven build tool users (including a Maven client, local build cache, and remote build cache backend). Support for the Google Bazel build system was introduced in 2023. Leveraging the in-depth observability provided by Build Scans, Develocity Remote Build Cache provides an enterprise-grade scalable backend that ensures that the maximum performance benefits of build caching can be realized. Together with Develocity performance profiling and analytic capabilities, it's easy to discover inefficiencies, identify optimization opportunities, and troubleshoot efficiently.


A build cache is very different and complementary to the concept of a binary repository (sometimes referred to as a dependency cache or artifact repository). Whereas a binary repository is for caching binaries that represent dependencies from one source repository to another, a build cache caches build actions, like Gradle tasks or Maven goals. A build cache makes building a single source repository faster.


When the build action inputs have not changed, the output can be reused from a previous run. Build caching can be applied to build actions like compilation, testing, source code generation, Javadoc, checkstyle, PMD. Build caching works out of the box for many standard Gradle tasks and Maven goals. For Maven goals or Gradle tasks that are not pre-configured to be cacheable, there is a cache configuration DSL available. That way, custom build actions are also cacheable.


The typical use case is to let CI builds push to a distributed remote build cache, and allow other CI builds as well as developer builds to pull from it. A local build cache is also available to reuse outputs produced earlier on the same machine.


Because Develocity Build Cache supports local, remote, and CI builds, it's used to not only improve developer productivity but also cloud costs and resource consumption efficiency.

Key Benefits

  • Faster build and test feedback cycles: By eliminating redundant work, Gradle build times are often cut in half and Maven build times can be reduced by up to 90%.

  • Improved DevProd and developer experience: Minimizing build and test time makes developers more productive and happier since they spend less idle time waiting for feedback.

  • Higher quality software: Fast feedback cycles mean developers build more often and more frequently, rather than pushing quality checks to later stages of the development cycle.

Key Features

  • Easy to deploy: By eliminating redundant work, Gradle build times are often cut in half and Maven build times can be reduced by up to 90%. Deploy and operate a stateless cache with very little effort. Local caching is built into the Gradle Build Tool, and Docker, Kubernetes, and standalone JAR deployment options are available for remote cache nodes.

  • Highly observable config and performance data: Use Build Scan to view Build Cache configuration settings and performance data for every local, remote, and CI build, such as cache requests, hits, misses, inputs stored to cache, and configuration settings.

  • Build Cache performance dashboards: Use Performance and Trends dashboards to continuously observe the Build Cache's impact on your feedback cycle times and monitor for speed regressions that may require proactive remediation before developers are impacted.

  • Local, remote & CI builds: The Build Cache can accelerate builds in local, remote, and CI environments. Distributed teams can read from a reliable cache that is constantly being populated by CI.

  • Multiple build tool environments: Build Cache works for Gradle and Maven builds. Any JVM language that can be built by Gradle or Maven can benefit from caching, and task inputs and outputs can be optimized for the best possible performance.

  • Build Cache miss diagnostics: Develocity task inputs comparison visualizes differences in inputs between tasks of two builds, which can be used to identify the root cause of a cache miss.