groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject Custom Plugin,which configures and executes maven-publisher
Date Wed, 09 Dec 2015 12:04:34 GMT
Hi all,

I am new to the mailing list (and to groovy plugin development) and have question, which which
wasn't answered by any of the "groovy plugin development"-tutorials, that I found.

I have a custom groovy plugin, which defines a task and provides an extension.

       public void apply(Project project) {

             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:

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!!!

View raw message