Hi, I’m trying to get started with developing an Openfire plugin. I followed the plugin dev guide and literally copied the sample code, pom and plugin.xml. I even managed to find the little line that says that the output jar needs to be renamed. But when I upload the produced jar (demo-openfire-plugin-assembly.jar renamed to demo.jar) openfire complains that it doesn’t contain a plugin.xml: org.jivesoftware.openfire.container.PluginManager - Error installing plugin 'demo.jar': Unable to find 'plugin.xml' in archive.. When I manually inspect the archive indeed there is no plugin.xml included. If I manually add the plugin.xml file to the archive then openfire accepts the plugin.
Is something broken in the build scripts? Or am I just missing something?
Also, following the directory structure as examplified for me produces a jar without any classes in it. Putting the Java source src/main/java/, not in src/java/ as the guide suggests, fixes this for me.
Also also, I see several people posting the forum because they forgot to rename the assembly file. However the maven assembly plugin can be configured to do that for us. Wouldn’t it be nice to include that in the sample pom.xml? See Override maven-assembly-plugin output file name - Stack Overflow
Thanks for taking the time to report this. The way that we build a plugin (and the corresponding documentation) could be improved a bit - no argument there.
I suspect that the plugin.xml file in your source code is located in the wrong place. Try moving it down one directory. I’d love to find a way to better guard against things like this.
With regards to the automatic renaming of the plugin’s JAR file: that would override the standard JAR file generated by Maven, which is sometimes needed to exist (when another plugin depends on the plugin that you’re creating). I’m not sure if this warrants the default mechanism to continue to exist as-is, but alas, that’s where we’re at today.
Hi @guus, thanks for your response! My plugin.xml lives in the root of my plugin project folder, next to the pom.xml file and the src directory. Is this not the right location? Moving it further up would mean moving it out of the project directory, which seems weird. Moving it down I would need to choose directory to move it into.
As for the difference between src/main/java and src/java that you mentioned. This stems from a time where our plugins were built by an Ant script (yes, we’re old). When moving to Maven, the old directory structure was retained. Note that pom.xml typically includes something like <sourceDirectory>src/java</sourceDirectory> in the build section.
Thanks for the suggestion. I also just happened to get it working. The sample pom file pins org.igniterealtime.openfire.plugins to version 4.7.0. Upping this to 4.9.2 fixes the issue.
This sourceDirectory directive is not mentioned in the sample pom.xml file. So anyone blindly following the guide is likely to bump into this.
In general starting from the justmarried plugin seems like a good idea.