groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schalk Cronjé <ysb...@gmail.com>
Subject Re: Custom Plugin,which configures and executes maven-publisher
Date Wed, 09 Dec 2015 12:54:26 GMT
Hi Stefean,

This seems to be a Gradle question, but better to be asked on the Gradle 
forum -> https://discuss.gradle.org

Regards

On 09/12/2015 14:04, Stefan.Rademacher@tk.de wrote:
>
> 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.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
>


-- 
Schalk W. Cronjé
Twitter / Ello / Toeter : @ysb33r


Mime
View raw message