Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Intellij IDEA manage plugin dependencies?

After playing with Intellij IDEA plugins for a while, I have noticed that plugins with external dependencies work fine, even if these dependencies are not bundled with the plugin itself nor are they publicly declared anywhere.

Picking a random example: the GenerateToString plugin depends, among other things, on log4j. But if you take a look inside the jar file, you will see that it contains only its own classes plus some resources (images and html files) and metadata (the obligatory plugin.xml and the MANIFEST.MF), none of which has any reference to log4j. And that jar file is the only thing you need to install the plugin.

How is that possible? How does IDEA manage these dependencies, so that it doesn't throw a ClassNotFoundException or something like that in runtime?

like image 750
Otavio Macedo Avatar asked Jul 15 '12 13:07

Otavio Macedo


1 Answers

IDEA uses custom classloader, if it doesn't find the required class in the plugin distribution, it's searched in all the jars located in IDEA_HOME/lib directory.

like image 68
CrazyCoder Avatar answered Oct 15 '22 05:10

CrazyCoder