TaskContainer.contains returns true for diff project task with same name

Consider a root project with task :mytask.
In root project build script If I use tasks.contains(otherPojecttTask), where otherProjectTask is :subproject:mytask, it returns true (incorrect), but the tasks container only contains root tasks :mytask, not :subproject:mytask.
It seems that only the task name is compared, but it should also compare the project.

Sample repo: GitHub - cdalexndr/gradle-19219: https://github.com/gradle/gradle/issues/19219
Github issue: TaskContainer.contains not working for different project task · Issue #19219 · gradle/gradle · GitHub (closed as invalid !?)

Imho you are correct and this is a Gradle bug.
Added my 2ct to the issue. :slight_smile:

1 Like