# How to specify "dependsOn" on the custom task defined in groovy class that extends from DefaultTask?

**URL:** <https://discuss.gradle.org/t/how-to-specify-dependson-on-the-custom-task-defined-in-groovy-class-that-extends-from-defaulttask/3617>\
**Category:** Old Forum Archive\
**Created:** [July 3, 2013, 2:59pm UTC](https://discuss.gradle.org/t/how-to-specify-dependson-on-the-custom-task-defined-in-groovy-class-that-extends-from-defaulttask/3617 "2013-07-03T14:59:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dmitriy\_Tserekhman](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/dmitriy_tserekhman/32/577_2.png) [@Dmitriy\_Tserekhman](https://discuss.gradle.org/u/Dmitriy_Tserekhman)\
**Post date:** [July 3, 2013, 2:59pm UTC](https://discuss.gradle.org/t/how-to-specify-dependson-on-the-custom-task-defined-in-groovy-class-that-extends-from-defaulttask/3617/1 "2013-07-03T14:59:00Z")

</div>

Hi,

I’m moving tasks from build.gradle into their respective groovy class definitions that extend from the DefaultTask so I can then reference these tasks in my custom plugin.

My question is how do I indicate that one task depends on another? In build.gradle I used “dependsOn” clause, but how do I specify it in my custom task groovy class implementation?

Thanks, Dmitriy.

---

<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:** [July 4, 2013, 9:56am UTC](https://discuss.gradle.org/t/how-to-specify-dependson-on-the-custom-task-defined-in-groovy-class-that-extends-from-defaulttask/3617/2 "2013-07-04T09:56:00Z")

</div>

You don’t. Task dependencies are declared by the party (build script or plugin) declaring the task instance, not by the party implementing the task type.
