# Implicit task dependency on directory

**URL:** <https://discuss.gradle.org/t/implicit-task-dependency-on-directory/44363>\
**Category:** Help/Discuss\
**Created:** [November 29, 2022, 9:42am UTC](https://discuss.gradle.org/t/implicit-task-dependency-on-directory/44363 "2022-11-29T09:42:38Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![schaarda](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@schaarda](https://discuss.gradle.org/u/schaarda)\
**Post date:** [December 2, 2022, 9:36am UTC](https://discuss.gradle.org/t/implicit-task-dependency-on-directory/44363/3 "2022-12-02T09:36:07Z")

</div>

Thank you for your answer, Björn.

I know that using the same output directory is considered a code smell.  
In our use case we have a custom task (TransformXml) which is executed multiple times with different parameters. After all of them are executed I want a task to pack them all into 1 zip file. My hope was, that the zip-File task could trigger all of these tasks at once (like mentioned here: [Gradle 7.0 seems to take an overzealous approach to inter-task dependencies](https://discuss.gradle.org/t/gradle-7-0-seems-to-take-an-overzealous-approach-to-inter-task-dependencies/39656))

Can you help me with another similar problem:  
I have a Task to extract an archive. Now I want another task to work with the extracted files and have an implicit dependency between them. How do I specify the output-input-relation correctly? I tried:

```gradle
val unzip = task<Copy>("unzip") {
    from(zipTree(myConfiguration.singleFile).matching {
        include("de/foobar/**")
    }.files)
    into("build/foobar")
}

task<ZipConsumer>("zipConsumer")
{
    inDir.set(unzip.destinationDir)
}

abstract class ZipConsumer: DefaultTask() {
    @get:InputDirectory
    abstract val inDir : DirectoryProperty

    @TaskAction
    fun action() {
        println("ZipConsumer: ${inDir.asFile.get().absolutePath}")
    }
}

```

But again, the unzip-Task is not executed automatically when I call zipConsumer. I really don’t want to use dependsOn because I can totally understand that this is not the intended way.

---

_[View the full topic](https://discuss.gradle.org/t/implicit-task-dependency-on-directory/44363)._
