Skip to content

Gradle Build Cache

Avrea provides a build cache endpoint for Gradle. Build outputs are cached so that tasks with unchanged inputs are never re-executed.

Gradle is pre-configured via ~/.gradle/init.gradle:

~/.gradle/init.gradle
gradle.settingsEvaluated { settings ->
settings.buildCache {
remote(HttpBuildCache) {
url = uri("http://avrea-host:8290/gradle-build/cas/")
push = true
allowInsecureProtocol = true
}
}
}

Your workflow needs no changes to point at Avrea. Just make sure the Gradle build cache is enabled (--build-cache flag or org.gradle.caching=true in gradle.properties):

workflow.yml
jobs:
build:
runs-on: avrea-ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-java@v5
with:
distribution: temurin
java-version: '21'
- run: ./gradlew build --build-cache

Add to your project settings.gradle:

settings.gradle
// settings.gradle
buildCache {
remote(HttpBuildCache) {
url = uri("http://avrea-host:8290/gradle-build/cas/")
push = true
allowInsecureProtocol = true
}
}

Then enable it in your workflow:

- run: ./gradlew build --build-cache

The --build-cache flag enables the remote build cache. You can also set org.gradle.caching=true in gradle.properties to enable it by default.