1

The issue :

All my custom task in my gradle project are always launch, even When I don't call them./don't depend them

The context:

I adding multiple custom task to my project

    this.tasks.add(task(MyTask(type: Copy) {
        dependsOn "publish"
        println "MyTask"
    }))

My issue is that all my custom task are always launched (even when I do just a clean !)

    >gradle clean 
     ...
     log: MyTask
     ...

I don't have a dependsOn MyTask hidden anywhere. I have the same issue with task who don't depend of anything and are not depended by anything .My IDE put the MyTask in the category "other".

I've use a taskTree plugin, who don't reveal anything expect:

  > gradle clean tasktree 
     ...
     log: MyTask
     ...
     "no mention of MyTask in the tree, but it's launched anyway"

and also

  >gradle clean MyTask tasktree
     ...
     log: MyTask
     ...
     :myProject:MyTask
     \--- :myProject:publish

How can I forbid the launch of MyTask when I don't do publish?

sab
  • 4,352
  • 7
  • 36
  • 60
  • 1
    Possible duplicate of [Why is my Gradle task always running?](https://stackoverflow.com/questions/20737494/why-is-my-gradle-task-always-running) – JB Nizet Jun 16 '19 at 15:15
  • I have following it, but know I have only the first "doLast" who run :( – sab Jun 17 '19 at 20:06

0 Answers0