Plugin development: using the <parentplugin/> element

Hi folks,

I’m starting out development of an OpenFire plugin. I would like for it to be dependent on Kraken, so I am using the element in plugin.xml. In my code, I am attempting to reference some constants defined in Kraken source, and I am getting compile-time errors, indicating that the constants cannot be found.

The build doesn’t seem to do anything with parentplugin - I presume that currently this information is only processed and used at runtime? So, the question is, what should I do? I could include the kraken plugin jar in the lib dir of my own plugin (and maybe not even bother with the element), but that seems somewhat wasteful, since then it will get loaded twice. Also, if I were to update the version of kraken in use, I would need to update it in two places - kraken as a plugin, and kraken as a library referenced from my plugin.

It should be possible to parse the plugin.xml file for the parentplugin element, and then if one is found, use the actual jar from the target/plugins directory on the classpath… I could write this functionality myself. Would it be a useful thing to contribute back to the community?

Hah. I have discovered that the plugin jars are a bit more complicated than I initially expected =). Just putting kraken.jar into the lib dir doesn’t really work, since the jar contains all those .pack files, rather than just classes =). Looks like I need to do a bit more looking into how these things work.

Or just work around it for now by redefining the constants I wanted to use from kraken…

I am still wondering if the ability to actually refer to classes from the parent plugin would be useful at build time. Anyone care to weigh in on this? I can look into it, if people actually think it would be valuable.