Question: I have the following project structure `settings.gradle`:

```
include 'B'
include 'C'

rootProject.name = 'A'

```

How add gradle to subproject root project as dependency?

Answer: 
As far as the `project` method is concerned, the root project has no name. So this is the syntax in project B's build.gradle:

```
dependencies {
  compile project(':')
}

```

However, it is rarely a good idea to do this. It is too easy to end up with circular dependencies. Most multi-module projects have a separate "main" projects (called something like "main", "core" or "base"), and other modules can easily depend on that using `compile project(':core')` or whatever.
I assume the question being asked is: **"How to add a Gradle root project as dependency to a subproject?"**

The following worked for me, when I added this in my subproject's build.gradle.

```
dependencies {
    //Add the root/parent project as a dependency
    compile project(":")
}

//Without this, my subproject's tests would not compile or run
sourceSets {
    test{
        compileClasspath += project(":").sourceSets.main.output.classesDirs
        runtimeClasspath += project(":").sourceSets.main.output.classesDirs
    }
}

```

Note: I am using gradle version 5.6.4.