# includeFlat and "cyclic reference"

**URL:** <https://discuss.gradle.org/t/includeflat-and-cyclic-reference/3737>\
**Category:** Old Forum Archive\
**Created:** [October 15, 2013, 11:29pm UTC](https://discuss.gradle.org/t/includeflat-and-cyclic-reference/3737 "2013-10-15T23:29:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dimitriy](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@Dimitriy](https://discuss.gradle.org/u/Dimitriy)\
**Post date:** [October 15, 2013, 11:29pm UTC](https://discuss.gradle.org/t/includeflat-and-cyclic-reference/3737/1 "2013-10-15T23:29:00Z")

</div>

So - we have “uncommon” workspace that looks like this:

/ /project1/… project1 files … /project1/settings.gradle /project1/build.gradle /project2/… project2 files …

I want to be able to build project2, and project1 that depends on it. The problem is - the gradle doesn’t know which project is root one, and throws error at me when i try to load it inside IDEA or even build it. And I, even after using Google and searching forums, still don’t know if it’s possible to do that and if it is, how?

Here is settings.gradle:

```gradle
includeFlat 'project1', 'project2'

```

I tried to set

```gradle
rootProject.name

```

and play with it. I even tried to manipulate with

```gradle
project(...)

```

. If scripts are moved to different directory (same level) everything start to work - but I need build script to be placed inside project1 because of “unusual” project requirements.

---

<div class="post-metadata">

**Author:** ![Peter\_Niederwieser](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@Peter\_Niederwieser](https://discuss.gradle.org/u/Peter_Niederwieser)\
**Post date:** [October 16, 2013, 12:14am UTC](https://discuss.gradle.org/t/includeflat-and-cyclic-reference/3737/2 "2013-10-16T00:14:00Z")

</div>

You need to remove ‘includeFlat ‘project1’’, because that’s the root project, and the root project is always included automatically. Also you’ll need to execute all builds from the ‘project1’ directory (or pass that directory via ‘-p’), so that Gradle finds ‘settings.gradle’. You can run a project2 task with ‘gradle :project2:someTask’. You cannot ‘cd’ into ‘project2’ and run ‘gradle someTask’, as you would normally do.
