Speed Up Your Gradle Builds!

Looking for ways to speed up your Gradle builds? Look into setting the following flag.

  • -Dorg.gradle.configuration-cache.read-only=true

It took me a little bit of time to understand this setting and the benefits. This flag is really beneficial when you are NOT using the same static build agent each time. (e.g. GitHub Hosted Runners, AWS Code Build)

In a nut-shell, when running in normal mode, configuration cache entries are written to your project directories configuration-cache folder during the configuration phase. This is good for static build servers. No need to write to the configuration-cache folder when the build server changes each time.

Sample Code:

      - name: Build project (with read-only configuration cache)
        run: |
          ./gradlew build shadowJar \
            --no-daemon \
            -Dorg.gradle.configuration-cache.read-only=true

Review the official documentation link below.

Hello, Welcome to DevOpsUnleashed!

A blog dedicated to sharing information about DevOps. Here, you’ll find examples, tips, and tutorials on DevOps.

Feel free to share your experiences in the comments!

Blog Categories