I'd like to have plugin A depend on plugin B and essentially share the same class loader. Is there a way to declare that level of cooperation between plugins? I haven't found anything of the sort and can't configure the dependent plugin to share modules with its dependency. Basically the problem is that plugin A depends on some of the same modules as plugin B. Here's a simplified illustration:
It's vital that classes from Module 2 share the same loader regardless of the enclosing plugin. So, again, I'd like to somehow declare that Plugin A extend Plugin B, so that they live in the same loader. Note the unfortunate reality is that both Module 1 and Module 2 involve several modules in a gnarly dependency graph (read, they can't be factored out).
The only "solution" I've come up with, since we own both plugins, is to make Plugin A and Plugin B just regular modules and support only one plugin at a time. As such the actual plugin modules are just wrappers where the wrapper for plugin A is a merge of the features of both plugins. Sigh.