How to make Intellij IDEA use parallel and gradle build cache for building

3.6k views Asked by At

What controls how an Intellij IDEA IDE build / rebuild uses the gradle build cache and parallel options?

I have gradle build cache setup and if I run gradle via IDEA runConfiguration I see the following:

45s clean build --parallel -x test
34s build --parallel -x test

If I click on the hammer to build or select Build : rebuild, I see times of 2m10s and above.

How I enabled the cache

On the commandline and via a runConfiguration, the speed increase is excellent. When building via Intellij's hammer things are much slower

gradle.properties

# Enable gradle build cache
org.gradle.caching=true
gradle.cache.push=false

settings.gradle

ext.inJenkins = System.getenv().containsKey("BUILD_NUMBER")

buildCache {
  local {
    enabled = !inJenkins
  }
  remote(HttpBuildCache) {
      enabled = true
      url = "${artifactory_url}/gradlecache-generic-development-local/"
      ...
      push = inJenkins
  }
}
1

There are 1 answers

2
Kamal AZZOUZI On

Probably you don't have parallelism enabled in gradle properties.

Add to gradle.properties

org.gradle.parallel=true

have a good day