I completely agree with Mark’s recommendation.
I’ll also add that in many cases the artifact of a publication should be the output of a task.
If the task is not an AbstractArchiveTask:
artifact( tasks.someTask.outputs.singleFile ) {
...
builtBy tasks.someTask
}
or if the task is an AbstractArchiveTask:
artifact( tasks.someTask )
@mark_vieira Is there any interest in having a shortcut in Gradle that handles non-AbstractArchiveTask’s in the manner I show above? If so, perhaps it’s something I could look at providing a pull request for.