Status: Resolved (View Workflow)
Consider plugins A and B.
A has an optional dependency to B.
B exposes an extension point called B.
A contains an @Extension(optional=true) or an @OptionalExtension(requiresPlugins = "B") (when using the variant plugin)
and has public class A extends B.
- Set up a new Jenkins instance
- Install plugin A
- Install plugin B
- Check groovy console ExtensionList.lookup(B.class)
- An empty list is returned. Expected to see class A singleton.
After restarting the Jenkins instance, class A singleton is listed properly.
JENKINS-19976fixed classloading in this kind of situation
- JENKINS-19508 is proposing to eliminate this use case altogether
- JENKINS-49026 is a consequence of this problem
- relates to
JENKINS-49026 Plugins are not installed in right order in case of optional dependency
JENKINS-19508 Replace @Extension(optional=true) and optional dependencies with bridge plugins
JENKINS-19976 Cannot load a class in depended plugin after install before restart
JENKINS-14392 Optional Extensions should be reloaded when dependencies are dynamically loaded
- links to
Fixed in 2.127.
danielbeck vlatombe It is categorized as RFE, and I do not consider it as backportable. Are you fine with that?
Code changed in jenkins
User: Vincent Latombe
JENKINS-50336Fix loading optional extensions after installing a missing dependency (#3370) JENKINS-50336Only keep extensions that could be loaded in memory
So that delta computations will re-attempt to load any extension that
previously failed or was skipped after a new plugin is installed.
After installing a plugin, need to refresh extensions in order to pick
up extensions that can be loaded thanks to this new plugin.
JENKINS-50336@OptionalExtension annotated classes were not being picked up after dynamic load of variant
Recompute GuiceExtensionAnnotation list when refreshing extensions
*NOTE:* This service been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.