Hi :wave:, I have a kotlin project which has 2 dep...
# kotlin-native
Hi 👋, I have a kotlin project which has 2 dependencies which have a couple of same gradle tasks. Therefore I end up in
Copy code
A problem occurred configuring project ':shared'.
> Failed to notify project evaluation listener.
   > Cannot add task 'xxx' as a task with that name already exists.
Can you please tell me how to explicitly exclude/disable a task for a dependency?
hmm, not really sure, if I understood your challenge (as for me a dependency is something inside dependencies { implementation("groupartifact0.5.1") }. but generally, one way to define a new/non-existing task in a build.gradle.kts of a (sub)project via:
Copy code
val myNewTask = tasks.register("myNewTask") { ... }
and if that task already exists (e.g. a plugin created it or a allprojects { ... } / subprojects { } clause in your rootProject, then you can "add" something to the task with
Copy code
val myNewTask by tasks.existing { ... }
Copy code
tasks {
    val myNewTask by existing {
        println("evaluating HERE")
        doLast {
            println("execution HERE")
so no need for disabling ... just use
val myNewTask by existing
(or did I misunderstand where your "dependencies" come from which do define/`register` task 'xxx' ??)
Hi Dirk, nice to meet you here and thanks a lot for your answer. My problem is one from hell probably 😞. Not sure how I get there. 1st the naming dependency was maybe a bit unlucky chosen. What I mean: • I have 2 plugins, Plugin A and Plugin B • both plugins are 3rd party • both of them have 3 gradle tasks which are exact the same Therefore I got the error on a gradle build attempt that 2 plugins try to add tasks with same name. I posted above this message the exception stacktrace
My desperation paired with frustration is also a bit high atm because I have no idea what to do here to fix this. Therefore I am extremly grateful for every tip and proposal which may lead to solve this issue
more of a Gradle question than anything Kotlin-related — you'd have the same issue with duplicate task registrations in any project. see the channel description in #gradle for a link to the Gradle community Slack, or use their other online resources
but in short: you should not have multiple plugins that register the same task. you can extract the common logic out into a third plugin that both of your current plugins apply first.