Plugin as a source of shared (common) libraries

Is it possible to set up a plugin structure and build process so that one plugin can act as a source of shared libraries for other plugins?

I've pretty much finished the first version of a feature I'm working on.  Right now, it consists of two plugins (but may consist of others later as well).

The two plugins both use some common code, packaged in a number of different jars.  In Eclipse, that I'm porting this from, I can handle this by making a plugin/OSGi bundle containing the dependencies, and making the dependents depend on that bundle.

I've got something like a "common-libs" plugin set up in the workspace now, and have projects that need it specifying a dependency on it.  But when I run the build process, the dependencies just get bundled up into the lib directory of each plugin - which is a big duplication and defeats the point of trying to share them.

I noticed that for something that is built in to the product, like junit, then junit depends on junit_rt, and I see the same thing there - the final junit plugin just has a junit_rt.jar inside it.

 

So is this possible with IntelliJ, or is copying the jars to each plugin part of the design to ensure each plugin is isolated from any other changes to other plugins?

 

Thanks.

Please sign in to leave a comment.