Dynamically load plugin dependencies from project's SDK

Hey all,
 
I was really not sure how to word that title, but here is a summary of my situation:
 
1) The company I work for provides a series of jars for our application
2) These jars vary by version of our application
3) There are implementations of multiple versions of our application going on in parallel
(all very typical stuff so far)
 
I am in the process of creating a plugin to help with some development.  Our company has been very excited by the fact that IDEA now has a community edition, so we are looking to suggest to our clients that they use IDEA and our plugin.  Within my plugin I would like leverage APIs in our jars.  I do not want to have to maintain a version of our plugin for each version of our application.  Instead I would like the end users of our plugin to select the series of jars that applies to what they are working.  All sounds good so far, right?
 
Well, I had added an "SDK" for our jars to be loaded in and that is working all nice and fine.  It is based on the sdk portion of the devkit plugin.  The problem is, no matter what I do I cannot seem use those libraries within my plugin.  I would settle for using these libraries at any point in the lifecycle - as an action, module component, application component, anything.  I have searched to my wits end, reading lots and lots of code from the community edition, looking at a number of plugins, and it seems like I cannot find the correct place for this to happen.  
 
Is this possible?  If so, is there a concrete example?  Any advice?  Am I crazy for trying to do this?
 
Thanks

 

1 comment
Comment actions Permalink

Hello Nicholas,

In your plugin, you need to create a classloader that includes in the classpath
both the jars selected by the user and the code of your plugin. The classes
from a configured SDK aren't added to the classpath of a running plugin,
so the SDK component is irrelevant here.

I was really not sure how to word that title, but here is a summary of
my situation:

1) The company I work for provides a series of jars for our
application
2) These jars vary by version of our application
3) There are implementations of multiple versions of our application
going on in parallel
(all very typical stuff so far)
I am in the process of creating a plugin to help with some
development.  Our company has been very excited by the fact that IDEA
now has a community edition, so we are looking to suggest to our
clients that they use IDEA and our plugin.  Within my plugin I would
like leverage APIs in our jars.  I do not want to have to maintain a
version of our plugin for each version of our application.  Instead I
would like the end users of our plugin to select the series of jars
that applies to what they are working.  All sounds good so far, right?

Well, I had added an "SDK" for our jars to be loaded in and that is
working all nice and fine.  It is based on the sdk portion of the
devkit plugin.  The problem is, no matter what I do I cannot seem use
those libraries within my plugin.  I would settle for using these
libraries at any point in the lifecycle - as an action, module
component, application component, anything.  I have searched to my
wits end, reading lots and lots of code from the community edition,
looking at a number of plugins, and it seems like I cannot find the
correct place for this to happen.

Is this possible?  If so, is there a concrete example?  Any advice?
Am I crazy for trying to do this?

Thanks

---
Original message URL:
http://www.jetbrains.net/devnet/message/5263759#5263759

--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0

Please sign in to leave a comment.