jenkinsci/jenkins — pull request #1054 by ikedam (2013-12-10 15:09:05+00:00)
Title: [JENKINS-19976] Enable plugins to load classes from newly installed plugins.

Think a case that plugin-A optionally depends on plugin-B.
If plugin-B is installed after plugin-A is installed, it gets followings in the current version of Jenkins:

* `Jenkins.instance.getPlugin("plugin-B")` returns a valid value.
* a class in plugin-B is failed to load from plugin-A.

As plugins often uses `Jenkins#getPlugin` to see whether they can use classes in optionally depending plugins, this causes `NoClassDefFoundError` until restarting Jenkins.

This patch allows plugin-A to load classes from plugin-B even without restarting Jenkins.

You can see how it works as followings:
1. Install Parameterized Trigger plugin (this is plugin-A).
2. Install Conditional BuildStep plugin (this is plugin-B).
3. Go to Manage Jenkins > Script Console, and run following script:
```
println(Jenkins.instance.getPlugin("conditional-buildstep"));
println(hudson.plugins.parameterizedtrigger.Plugin.class.classLoader.loadClass("org.jenkinsci.plugins.conditionalbuildstep.ConditionalBuildStepHelper"));
```

Without this patch, you will see the former statement returns a valid value, but the latter statement throws `ClassNotFoundException`. (this is what is reported in [JENKINS-19976] (https://issues.jenkins-ci.org/browse/JENKINS-19976) ).
With this patch, the latter statement also works fine.