# \[native\]: How to create dependencies between model-space tasks in different build scripts

**URL:** <https://discuss.gradle.org/t/native-how-to-create-dependencies-between-model-space-tasks-in-different-build-scripts/19900>\
**Category:** Help/Discuss\
**Created:** [October 6, 2016, 7:11pm UTC](https://discuss.gradle.org/t/native-how-to-create-dependencies-between-model-space-tasks-in-different-build-scripts/19900 "2016-10-06T19:11:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [October 6, 2016, 7:11pm UTC](https://discuss.gradle.org/t/native-how-to-create-dependencies-between-model-space-tasks-in-different-build-scripts/19900/1 "2016-10-06T19:11:46Z")

</div>

I have a project with a few different native components to build, and the build script was getting large enough that I wanted to break out the component config into their own build script files, using `apply from:` to aggregate them into `build.gradle`.

I have a few model-space tasks defined with each component, and in the main `build.gradle` file, I’d like to create a `dependsOn` relationship between one of the tasks in one component’s build script and a task in another component’s build script.

But, I can’t find a way, from within `build.gradle` to refer to either of these tasks without getting an error like this:

```gradle
* What went wrong:
A problem occurred configuring root project 'project-x'.
> Exception thrown while executing model rule: tasks { ... } @ build.gradle line 26, column 5
   > Could not find property 'someComponentTask' on task ':tasks'.

```

_Question_: Given the basic build script structure shown below, how can I change `build.gradle` so it correctly establishes a dependency between a model-space task defined in `buildSomeComponent.gradle` and a different model-space task defined in `buildSomeOtherComponent.gradle`?

**build.gradle:**

```gradle
apply from: 'buildSomeComponent.gradle'
apply from: 'buildSomeOtherComponent.gradle'

model {
    tasks {
        someComponentTask.dependsOn someOtherComponentTask
    }
}

```

**buildSomeComponent.gradle:**

```gradle
model {
    components {
        // component config here
    }
    tasks {
        someComponentTask(Exec) {
            // exec something
        }
    }
}

```

**buildSomeOtherComponent.gradle:**

```gradle
model {
    components {
        // component config here
    }
    tasks {
        someOtherComponentTask(Exec) {
            // exec something
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![chefhoobajoob](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@chefhoobajoob](https://discuss.gradle.org/u/chefhoobajoob)\
**Post date:** [October 6, 2016, 9:06pm UTC](https://discuss.gradle.org/t/native-how-to-create-dependencies-between-model-space-tasks-in-different-build-scripts/19900/2 "2016-10-06T21:06:19Z")

</div>

Never mind! Found that the task I was trying to set `.dependsOn` for had not been given a task type. As if, for example, the `someOtherComponentTask` definition above had been declared like so:

```gradle
    tasks {
        someOtherComponentTask {
        }
    }

```
