Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Gradle Goodness: Enable Build Cache for All Builds [Snippet]

DZone's Guide to

Gradle Goodness: Enable Build Cache for All Builds [Snippet]

In this short post, we take a look at a recent feature of Gradle: the build cache. This customizable tool can be a real time-saver, particularly for CI.

· Java Zone ·
Free Resource

Verify, standardize, and correct the Big 4 + more– name, email, phone and global addresses – try our Data Quality APIs now at Melissa Developer Portal!

Gradle 3.5 introduced the build cache. With the build cache, we can share task output between builds on different computers. For example, the build output from a continuous integration server can be used on a developer's computer. To use the build cache feature, we use the command-line option --build-cache.

Instead of using the command-line option --build-cache, we can set the Gradle property org.gradle.caching with the value true in the file gradle.properties of our project. To set this property for all our projects, we set the property in the gradle.properties file in the Gradle home directory, which is usually at USER_HOME/.gradle/gradle.properties.

In the following example, we set the property org.gradle.caching in ~/.gradle/gradle.properties:

# File: ~/.gradle/gradle.properties
org.gradle.caching=true


If we want to disable the build cache feature set via the global property, we can use the command-line option --no-build-cache to disable the build cache for a particular build.

Written with Gradle 3.5.

Developers! Quickly and easily gain access to the tools and information you need! Explore, test and combine our data quality APIs at Melissa Developer Portal – home to tools that save time and boost revenue. Our APIs verify, standardize, and correct the Big 4 + more – name, email, phone and global addresses – to ensure accurate delivery, prevent blacklisting and identify risks in real-time.

Topics:
gradle ,java ,groovy ,build cache

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}