Intuitive task() syntax for referring to a task from another project


(Mike Meessen) #1

Hi everyone,

As discussed in this topic (1), it would be nice if the ‘task()’ method would return a task when referenced like this in a multi-project build:

task(’:path:to:project:taskName’)

That would allow us to write:

  copy {

from { task(’:otherProject:createStuff’) }

into stuffDir }

… instead of the longer and more cumbersome …

  copy {



from { project(':otherProject').createStuff }



into stuffDir  }  

What are your thoughts? Would that be possible API-wise?

Best regards, Mike

– (1) http://forums.gradle.org/gradle/topics/refer_to_a_task_from_another_project_in_copyspec?rfm=1


(Luke Daley) #2

I like this idea. +1 from me.


(Peter Niederwieser) #3

Questions that come to mind are:

  • How often is this needed? * Do we want to encourage this? (In general, we want to move away from one project reaching out into another.)