Maven Build Cache Deep Dive


Get hands-on training on how to tackle build performance issues with the Maven build cache.

Description

In this training, you will learn the basics and best practices to make the most of caching in your build. We’ll discuss the different possible architectures, how they affect build performance, and how Develocity can help you manage, analyze, and troubleshoot the build cache.

Duration

3-hour training session followed by 30-minutes Q&A.

Audience

Maven build tool users, as well as Develocity users interested in speeding up builds, are encouraged to attend the training.

Prerequisites

This course assumes a good understanding of the Java language and working knowledge of Maven.

Objectives

After this training the participants will be able to:

  • Understand the benefits of using the Maven build cache
  • Use and configure the build cache
  • Optimize build logic for maximum cacheability
  • Maximize the benefits of the build cache with Develocity

Course Outline

Overview

  • Introduction
  • Performance is key
  • Approaches for work avoidance
  • Common use cases
  • Faster Maven builds on CI
  • Visualized savings in Develocity

What is the build cache?

  • How does it work?
  • Different types of build caches
  • Local build cache
  • Remote build cache
  • Recommended sharing strategy
  • Influencing factors

Using the build cache

  • Enabling the cache
  • Adding the Maven extension
  • Generating a build scan
  • Adding the Develocity server URL
  • What’s going on under the hood?
  • Configuring the local build cache
  • Lab: Using the local build cache
  • Referencing the Develocity credentials
  • Configuring the credentials
  • Enabling the cache on CI
  • Computing the build cache key
  • Build cache operations
  • Lab: Using the remote build cache

What makes a build “cacheable”?

  • Cacheability influencing factors
  • Cacheable plugins and goals
  • Customization of caching behavior
  • Configuring the Maven extension
  • Declaring inputs and outputs
  • Disabling cacheability
  • Lab: Equipping goals with caching capabilities

Troubleshooting the build cache misses

  • Possible approaches
  • Debug log level console information
  • Finding cause of cache misses
  • Using build scans

Requirements for cacheable goals

  • Repeatable goal outputs
  • Stable goal outputs
  • Path sensitivity
  • Input normalization

Handling cases affecting cache correctness

  • Overlapping outputs
  • External inputs like system properties
  • File encoding
  • Line endings
  • Symlinks
  • Java versions
  • Lab: Handling cache misses

Getting started with the build cache

  • Recommended approach
  • Installing the remote build cache
  • Connecting to Develocity

Wrap up

  • Documentation and resources
  • Try Develocity for free
About you
About your organization

By registering for Gradle training, you agree to accept Gradle's terms and privacy policy.