Can an IDEA plugin re-use the capabilities of an existing plugin

I am a noob to IDEA plugin development so please forgive me lack of knoweldge.

But I am investigating writing an IDEA plugin andone of the things I want it to do is "follow" the maven hierarchy like the current maven intergration plugin does

(eg you can click on an pom element and traverse up to its parent and so on smartly)

So I was hoping to re-use some of the components in that maven plugin fro my new plugin.

Is this even possible.  Is code contain in one plugin accessible from another?

Is it desirable?  It know that the maven plugin could change implementation and break my plugin.

I would like to answer this question before I end up "replicating reams" of exiting code.


ps.  My idea for a plugin is one that can "find the repo" of any given code.  It will descend up the file treee (jars or files) and look for maven scm information.

It will need to ascend MANIFEST/maven entries to do this and this is what I want to re-use if I can.

Does any one know if there is already a plugin that does this.  That is from any given code tell you what "repository" (scm) it comes from?

It would be a nice general IDEA feature ;) because we are all always searching for "where does this code come from"


Hopefully I'll provide a correct answer here based on my own experience.  Yes, you can declare a dependency on another plugin in your plugin.xml and whether that dependency is optional or not.  You would then add the jar for that plugin to your plugin SDK so that you can references its classes.  Of course, you need to make sure that you're using a stable, published interface from that plugin or you'll be introducing potential instability into your own plugin.  My plugin currently does this with the Coverage plugin.  Hope this helps!


Thanks for the answer Scoot.

If your plugin is open source, can your point me to a repository so I can see an example of this in action pease.



Brad, mine isn't open source, but here's an example from one that is:

Look at lines 28-30 and, because those dependencies are optional, the corresponding plugin configuration files when those dependencies are met:

If yours is a hard dependency, you can omit the config-file part and add the related configuration directly in your main plugin.xml.


Please sign in to leave a comment.