Multi-project builds where root build files are in a sub-directory of the project

Question about multiproject builds…

All of the samples show a directory structure where the settings.gradle & the main build.gradle lives at the root and the subprojects live underneath, as in this example where the project has 2 sub-projects - bluewhale & someotherfish:

water/

build.gradle

settings.gradle

bluewhale/

build.gradle

someotherfish/

build.gradle

Is there a way to configure a multiproject build where the main settings.gradle & build.gradle live in a child of the root and the sub-projects are side-by-side, as in this example?

water/

bluewhale/

build.gradle

someotherfish/

build.gradle

root/

settings.gradle

build.gradle

That’s what Gradle calls a flat directory layout. You should find plenty information about it in the Gradle docs (user guide etc.) and also on the forum. Basically, you just use ‘includeFlat’ instead of ‘include’ in ‘settings.gradle’. For best results, root should be renamed to master (though it is not required).