Multi project in gradle

I want to include My first project “Component1-1-1” inside my second project “Component1-1”, I added the following syntax to my setting.gradle file :
include ‘:Component1-1-1’
project(’:Component1-1-1’).projectDir = new File(settingsDir, ‘…/Component1-1-1’)
And I added to my build.gradle file :
earlib project(’:Component1-1-1’)
It worked fine, but my problem is that I don’t understand the usefulness of “:”, I tried to move the “:” , in settings.gradle :
include ‘Component1-1-1’
project(’:Component1-1-1’).projectDir = new File(settingsDir, ‘…/Component1-1-1’)
And in build.gradle :
earlib project(’:Component1-1-1’)
And everything works fine.

Here’s my understanding:

  • : is the path separator used in project hierarchies.
  • When calling project() in the build.gradle files, the path is relative to the current project.
  • When calling project() from settings.gradle, all paths are relative to the root and the leading : can be dropped.