Add dependencies to a `MavenPublication` / `IvyPublication`

I am working on a plugin that gets applied to a project which applies neither the java nor java-library plugin. Long back-story, but the gist is that the standard tasks added by each “get in the way” of what this plugin does.

So I have a project that is not a Java project as far as Gradle sees.

The plugin does however set up publications. In this respect I want the project to operate “as if” it were a Java project in terms of what gets published. I have most of this working, however the one piece that I cannot figure out is how to add dependencies to the publications.

Any pointers on how to achieve this manually? Aside from editing the XML ofc :wink:

How to manually add dependencies to Gradle's MavenPom/MavenPublication? - Stack Overflow for points on SO also