1

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
  }
}
Peter Kahn
  • 12,364
  • 20
  • 77
  • 135

1 Answers1

3

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

Add to gradle.properties

org.gradle.parallel=true

have a good day

  • Thanks. Any idea why intellij isn't using the build cache properties when CLI does? Also, I'm pretty sure that I only want parallel for the build and not test execution. – Peter Kahn Oct 15 '19 at 19:58
  • Please make sure to use same Gradle in command line and in IDE and have 'Gradle' set for the Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | 'Build and run using' option. Also invoke 'Build' action in IDE, not 'Rebuild'. – Andrey Oct 16 '19 at 06:53