Subprojects execution not happening in the order which we included in settings.gradle file in a multi-project environment

I am facing a problem with the projects execution order in a multi-project environment. Even after included my projects in which order has to be executed , it always executed in ascending order. My subprojects are- HelloWorld,Alpha,Beta and Neptune. My Projects execution should be , first “HellowWorld” should build ,next “Alpa”, next “Beta” and last “Neptune”. but presently it builds , first “Alpha”,next “Beta”, next “HelloWorld” and last “Neptune”.

This is how my settings.gradle file

include ‘HelloWorld’, include ‘Alpha’, include ‘Beta’ include ‘Neptune’

The order of includes in ‘settings.gradle’ is irrelevant. Execution order is solely determined by task dependencies. What’s probably missing in your case is the correct declaration of project dependencies in the ‘dependencies { … }’ blocks of the subprojects’ build scripts (from which task dependencies will be inferred automatically).

Hi Peter Niederwieser ,

Can you please elaborate how the sub-project dependencies will play the role in execution order?

See the “multi-project builds” chapter in the Gradle User Guide.