Skip to content

sinwe/gradle-hazelcast-plugin

Repository files navigation

Gradle Hazelcast cache backend plugin

Build Status Gradle Hazelcast Plugin Code Quality: Java Total Alerts

A simple settings plugin that enables build caching in Gradle with a Hazelcast node as the backend. The Hazelcast node itself needs to be set up separately.

For a production-ready build cache implementation (featuring node management, usage statistics, health monitoring, replication, access control and more), see Gradle Enteprise.

For an alternative http-based build cache implementation, see HTTP Build Cache Server

How to use

Add this to your settings.gradle:

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath "com.github.sinwe.gradle.caching.hazelcast:gradle-hazelcast-plugin:0.13"
  }
}

apply plugin: "com.github.sinwe.gradle.caching.hazelcast"

buildCache {
  // Note: the local cache is disabled by default when applying the plugin
  remote(com.github.sinwe.gradle.caching.hazelcast.HazelcastBuildCache) {
    host = "127.0.0.1"  //support comma separated multiple hosts
    port = 5701
    name = "gradle-build-cache"
    enabled = true
    push = true
  }
}

You can also specify the location and name of the Hazelcast cache via system properties (though values specified in the settings.gradle override the ones specified by system properties):

System property Function Default value
com.github.sinwe.gradle.caching.hazelcast.host host name of the Hazelcast node 127.0.0.1
com.github.sinwe.gradle.caching.hazelcast.port TCP port of the Hazelcast node 5701
com.github.sinwe.gradle.caching.hazelcast.name name of the cache gradle-task-cache