Plugin Development classpath confusion

I've been working on Eclipse plugin development for many years, and now I'm looking at porting some stuff to IntelliJ IDEA.


I've downloaded the community edition, and then followed the sample plugin tutorial, containing the menu action and the popup message box.  I then tweaked that a little to include calls to a class that I added as a JAR dependency to the plugin module, as I want to reuse some existing jar files in my project.


That was all fine.  Because I'd like to see lots of the code that's used in existing plugins, I then opened the "intellij-community" project that contains all the existing plugin modules, and planned to create my plugin as another module in that project.  I noticed that lots of the modules in that project (for example junit and coverage) are not defined as plugin modules, but just as "plain" java modules.  They contain src/META-INF/plugin.xml , rather than having resources/META-INF/plugin.xml


So, what exactly makes a module a plugin (or not a plugin)?  I noticed that for the "non" plugin modules, when opening the module settings page, they don't have the extra "Plugin Deployment" tab where the path to the plugin.xml is specified.


After I created a bigger plugin inside the "intellij-community" project , I wasn't able to reuse one of my existing jar files as a dependency in it.  I tried specifying it as a JAR dependency, I tried creating a library containing the jar file and adding the library as a dependency, and I also tried adding the jar file to a lib directory.  In all cases, I just get a NoClassDefFoundError for the class in the jar file when I run the plugin.


Because there are some layers of inheritance with classpath, JDK etc in the "intellij-community" edition, I tried running my plugin on its own from inside that structure.  I then got an error in the Run Configuration saying "Wrong SDK type for module".


Is it a bad idea to try and develop a new plugin from inside the "intellij-community" project ?  Or should it work OK, or are there some extra bits of magic that have to be done?

1 comment
Comment actions Permalink

3rd party plugins should be developed as stand-alone plugin projects created with DevKit as "IntelliJ Platform Plugin" module type.



Please sign in to leave a comment.