Hi all,

Currently I'm working on a plugin, which uses the PluginFirstClassLoader 
<https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/PluginFirstClassLoader.java>
 
to avoid library clashes with Jenkins 
<https://github.com/jenkinsci/groovy-events-listener-plugin/issues/21>.

*i.e. build.gradle 
<https://wiki.jenkins-ci.org/display/JENKINS/Plugin+Structure#PluginStructure-Classloader>*

jpi {
    manifest.attributes(["PluginFirstClassLoader": "true" ])
}


*The Problem*

Within the plugin, I want to be able to programmatically retrieve classes 
from a *single* classloader. i.e.

   - classes from within the plugin
   - classes from third party plugins

>From what I've read, it appears as though the PluginFirstClassLoader 
<https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/PluginFirstClassLoader.java>
 would 
satisfy this requirement(?), however, I can't find where it's stored at 
runtime...

The other option, is to create my own PluginFirstClassLoader (aka "
JoinClassLoader <http://www.source-code.biz/snippets/java/12.htm>"), by 
amalgamating the two classloaders below.


*What I've tried:*

Within the plugin, I can retrieve the following classloader's...

log.info(MyPlugin.class.getClassLoader().getClass());
log.info(Jenkins.getInstance().getPluginManager().uberClassLoader.getClass
());

Respectively gives:

class hudson.ClassicPluginStrategy$AntClassLoader2
class hudson.PluginManager$UberClassLoader


but neither are an instanceof PluginFirstClassLoader.


Any direction would be appreciated.


Kind regards,


Nick

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/a72de9c5-30a5-42db-9bf0-9f97993dbd3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to