I recently changed some settings in Gradle to speed up its process and one of them was changing this: org.gradle.configureondemand=true
property in gradle.properties
file.
I know you can guess a lot from the words "configuration on demand", but I wanna know the exact impact of this feature? Do I have to do something to trigger configuration if I set this argument as true
?
Can something go wrong if I set it as true
?
What configuration phase exactly is?
This setting is relevant only for multiple modules projects. Basically, it tells Gradle to configure modules that only relevant to the requested tasks instead of configuring all of them, which is a default behaviour.
To answer more precisely to your questions:
- No, you don't have to trigger configuration manually.
- Yes, something could go wrong as stated in the documentation. The
feature should work very well for multi-project builds that have
decoupled projects.
In “configuration on demand” mode, projects are configured as follows:
- The root project is always configured. This way the typical common configuration is supported (allprojects or subprojects script blocks).
- The project in the directory where the build is executed is also configured, but only when Gradle is executed without any tasks. This way the default tasks behave correctly when projects are configured on demand.
- The standard project dependencies are supported and makes relevant projects configured. If project A has a compile dependency on project B then building A causes configuration of both projects.
- The task dependencies declared via task path are supported and cause relevant projects to be configured. Example: someTask.dependsOn(
:someOtherProject:someOtherTask
)
- A task requested via task path from the command line (or Tooling API) causes the relevant project to be configured. For example, building
projectA:projectB:someTask
causes configuration of projectB.
Here is the full documentation.