Is there an easy way to upload archives from custom tasks?

( #1

I have a Copy task in my gradle build file- configurations.add(‘myArchives’) … task myCopy(type: Copy) {

from “.”

include ‘file.bin’

into buildDir


that I want to publish to the repo- artifacts {

myArchives myCopy }

which leads to an error (M6 build)- A problem occured evaluating project '… Cause: Notation is invalid for an artifact! Passed notation=task ':…

I’ve tried - task myCopy(type: Copy) {

from “.”

include ‘example.bin’

into buildDir

outputs.dir file("$buildDir") }

and - artifacts {

myArchives myCopy.outputs.dir }

replacing -

outputs.dir above with outputs.files, outputs.file, etc.does not help.

Would I need to use DefaultPublishArtifact or PublishArtifact() etc ? Is there any example in the case of a Copy task (or any Custom tasks that produce artifacts) that I could use? Thanks for your help.

( #2

I figured out one way to do this would be -

artifacts {

myArchives file("${buildDir}/example.bin") }

There are 3 possible ways (AbstractArchiveTask, File, Map) and File seems to work although I couldn’t get Map to work. The dsl guide has this info -