Refer to a task from another project (in copySpec)?

(Mike Meessen) #1

Is there a shorter way to refer to a task of another project in a multi-project build than "project(’…’).tasks.getByName(’…’)?

In project “myProject”:

  copy {

from { project(’:otherProject’).tasks.getByName(‘createStuff’) }

into stuffDir }

The full task path notation like in the doc:

  task taskX(dependsOn: ‘:projectB:taskY’)  

Doesn’t work in the copySpec (no error, the task’s output just isn’t taken):

  copy {

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

into stuffDir }

Best regards, Mike

(Luke Daley) #2


(Mike Meessen) #3

Thanks, as always, for the quick reply Luke :slight_smile:

Any chance ‘task(’:otherProject:createStuff’)’ could return the task someday? That syntax would feel the most intuitive…

(Luke Daley) #4

I actually quite like the idea. Best thing to do would be to raise a new “idea” topic focussed on adding this syntax. We can then see what the community thinks.

(Mike Meessen) #5