Compound Gradle Projects - tooltwist/documentation GitHub Wiki

If you have an application where you are working on the source of multiple Eclipse projects at the same time, you can define them to Gradle of sub-projects of a single root project. To do this, place a settings.gradle file in the directory above your project directories.

//define the root project  
rootProject.name = 'ttsvr'  
rootProject.projectDir = new File(settingsDir, 'ttsvr')  

//include sub projects  
includeFlat 'projectA'  
includeFlat 'projectB'  
includeFlat 'projectC'  

You can then specify definitions in your build.gradle file like this:

compile project(':projectB')`

Note that Gradle scans the directory hierarchy to try to determine the root project, and a settings.gradle file in any of the sub-project directories will prevent this from working properly.

PLEASE NOTE: In most cases you don't want to do this, as it complicates the Eclipse configuration and slows command line builds. A better approach seems to be to define the projects as simple projects, then after importing the Gradle dependencies into Eclipse to delete the sub-projects from the library list in Java Build Path and add the projects as regular Eclipse dependencies.