On Wed, Nov 27, 2013 at 1:23 PM, Hugo Arès <[email protected]> wrote:
> When Jenkins test instance initialize my plugin, PluginImpl is loaded by
> PluginFirstClassLoader

So that is the problem… this class loader probably needs to be tweaked
to behave differently in unit test mode, e.g. always checking the
classpath loader first.


Ideally JenkinsRule would actually prevent plugin classes from being
loaded from the classpath. They are put there by Maven’s transitive
dependencies, and have to be accessible from test classes of course.
Really you would want the classpath to be inspected for plugins, all
those to be loaded as real plugins by PluginManager, then the test
classes to be loaded using a class loader that delegates to these.
Unfortunately JUnit is not designed to work with module system, so you
have to do some serious hacks. Here is what NetBeans does to solve the
same problem:

http://hg.netbeans.org/main/file/default/nbjunit/src/org/netbeans/junit/NbModuleSuite.java#l787

Such a feature would be equally difficult for Jenkins, and probably
incompatible to do by default (i.e. it would have to be opt-in).

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to