Parallel Execution & Configuration
Configure Gradle for parallel task execution and understand its impact on build performance.
Parallel Builds: Speeding Things Up
Imagine you have several independent tasks that need to be done. If you do them one by one, it takes a long time. But what if you could do some of them at the same time?
This is the core idea behind parallel execution in Gradle. It allows Gradle to run multiple independent tasks simultaneously, which can significantly reduce your overall build time, especially for large projects or multi-project builds.
Activating Parallelism
Gradle's parallel execution is not enabled by default. You need to explicitly tell Gradle to use it. There are two main ways to activate it:
- Command Line: Use the
--parallel(or-P) option when running Gradle commands. - Configuration File: Add
org.gradle.parallel=trueto your project'sgradle.propertiesfile.
Using the command line option overrides the setting in gradle.properties.
All lessons in this course
- Build Cache & Daemon
- Profiling & Debugging Builds
- Parallel Execution & Configuration
- Incremental Builds and Task Inputs/Outputs