i am trying to set up maven publication programmatically using a plugin. the use case is an internal build plugin that enforces consisted behavior across many projects, one of which, is what gets published. i.e. the end game here is that our developers won’t need to repeat the “publications” section in all of their projects’ build.gradle script and instead our plugin will dictate that for them.
on the surface, this seemed to be working correctly, except that the POM generated is missing the dependencies. if i move the exact publications setup from the plugin to the project’s build.gradle it works correctly (i.e POM tracks
my setup (called from the plugin’s apply())
project.plugins.withType(PublishingPlugin) { PublishingPlugin publishingPlugin ->
def publishingExtension = project.extensions.findByName('publishing')
publishingExtension.with {
publications {
mavenJava(MavenPublication) {
from project.components.java
}
}
}
}