2 @Extension annotations in a plugin

16 views
Skip to first unread message

Bruno

unread,
Mar 18, 2015, 7:08:37 AM3/18/15
to jenkin...@googlegroups.com

Hello everyone,

With time and pain I did manage to create a bunch of plugins that do exactly what I wanted. But the thing is I've not always understood what I was doing. And I would like to know more about it.

My plugins all add a "post-build action" to perform some computation, and then display results on the project and build pages. The @Extension annotation is put on the inner Descriptor of the Publisher class.

But in one of my plugin, I've got 2 @Extension annotations.

In this plugin, I've got to use some list boxes to configure a job. First I tried to save all the configuration data in the inner Descriptor of my Publisher class, but it didn't work. The thing is these data were no more just simple Strings. Maybe there is a solution, I don't know. But anyway, looking at other plugins with list boxes, I found out a way to implement this in my plugin. I extended the GlobalConfiguration class and put a @Extension annotation on it, and then wrote methods etc..

But I still have the @Extension in my Publisher class. How does it work altogether ? I thought that the @Extension was kind of the door for Jenkins to enter the plugin.

I'm not sure if I'm clear, but thanks in advance.

Bruno

oliver gondža

unread,
Mar 18, 2015, 7:16:11 AM3/18/15
to Bruno, jenkin...@googlegroups.com
On Wed, 18 Mar 2015 12:08:37 +0100, Bruno <bruno....@liebherr.com>
wrote:

> But I still have the @Extension in my Publisher class. How does it work
> altogether ? I thought that the @Extension was kind of the door for
> Jenkins
> to enter the plugin.

@Extension is just an annotation Jenkins uses to auto-discover your
implementations of ExtensionPoint. You can have any number of
ExtensionPoint implementations in your plugin and therefore any number of
@Extension annotations.

Mixing the persistence of two unrelated classes together in obviously a
bad idea.

--
oliver
Reply all
Reply to author
Forward
0 new messages