Hi all,
I am new to the mailing list (and to gradle plugin development) and have question, which which wasn’t answered by any of the “gradle plugin development”-tutorials, that I found.
I have a custom gradle plugin, which defines a task and provides an extension.
public void apply(Project project) {
project.getPluginManager().apply(MavenPublishPlugin.class);
project.task("publishBundles", type: PublishBundlesTask)
def bundleGroup = project.container(BundleGroup)
project.configure(project) {
extensions.create("bundleToMavenPublisher", PublishBundlesExtension, bundleGroup)
}
}
I want the users of my plugin to configure stuff with the dsl, provided by my extension. My task reads the configuration and generates PublishExtension
configuration from it:
@TaskAction
def publishBundlesAction() {
if (bundleGroups == null) {
bundleGroups = project.bundleToMavenPublisher.bundleGroups
}
PublishingExtension publishingExtension = project.extensions.findByType(PublishingExtension)
publishingExtension.with {
publications {
// reuse content from bundleGroups variable here...
}
repositories { maven { url "..." } }
}
}
So far, this works well.
The problem, I couldn’t solve yet, is to execute the MavenPublishPlugin
from my plugin, so that it uses the previously generated configuration (publications, repositories).
Does anyone have a hint for me, how to solve this?
Thank you very much in advance!!!
Stefan