How to create a custom publish task?

Hi,

How can I create a custom task that will publish maven publications?

This is for test resources and other dependencies of the build which we keep in an artifact repository. I do not want these to run as a part of publish since we already use that task to publish the main publications.

This is somewhat similar to How can I combine publications with dependencies? but I thought it would be a much simpler task but it seems not. I’m sure someone must have encountered this before.

I’m really struggling here, any help would be greatly appreciated.

Cheers,
Jason

This is an untrue statement in the Gradle User Manual:

The fastest way to get help is through the Gradle Forum. Community members and core contributors answer your questions.

I get a much better response rate on StackOverflow. It is a shame, I would prefer to keep the information in one place.