On 09/18/2012 02:56 PM, Brian Lalor wrote:
I'm trying to get my head around how I'd configure some @Extension-
annotated classes I'm creating.  I've got a few different ones in the
plugin I'm working on.  I really don't want to have to use static
properties of my implementation of hudson.Plugin: that's ugly and
difficult to test.  But
>
        Jenkins.getInstance().getExtensionList(QueueTaskDispatcher.class)
returns an empty list when run from Plugin#start(), and ExtensionList#add() is 
deprecated.  So how do I configure my @Extensions before they get used?


From javadoc of the Plugin#start method [1],


        If a plugin wants to run an initialization step after all
        plugins and extension points are registered, a good place to do
        that is postInitialize(). If a plugin wants to run an
        initialization step after all the jobs are loaded,
        ItemListener.onLoaded() is a good place.

Does that clarify? The short answer is, you want to do that in postInitialize(), not in start().


[1] http://javadoc.jenkins-ci.org/byShortName/Plugin
--
Kohsuke Kawaguchi | CloudBees, Inc. | http://cloudbees.com/
Try Nectar, our professional version of Jenkins

Reply via email to