Configure Gradle to use Build Cache

JFrog Integrations Documentation

Content Type
Integrations
ft:sourceType
Paligo

Configure Gradle to use the build cache and point it to Artifactory.

gradle.properties

artifactory_user=admin
artifactory_password=password
artifactory_url=http://localhost:8081/artifactory
org.gradle.caching=true
gradle.cache.push=false

settings.gradle

Set the gradle.cache.push property to true, on the CI server, by overriding it using -Pgradle.cache.push=true.

include "shared", "api", "services:webservice"

ext.isPush = getProperty('gradle.cache.push')

buildCache {
  local {
    enabled = false
  }
  remote(HttpBuildCache) {
   url = "${artifactory_url}/gradle-cache-example/"
   credentials {
    username = "${artifactory_user}"
    password = "${artifactory_password}"
   }
   push = isPush
  }
}