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

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


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…

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.