Building an openfire plugin with maven

Hi,
I need to migrate openfire plugin from ant to maven. I’m using the maven-assembly-plugin with the standard openfire-plugin-assembly descriptor, but the final JARd don’t comply with the previous ones built with ant.
The Openfire Plugin Developer Guide states the JAR structure for a plugin to be deployed in Openfire should be as follows:
myplugin/
|- pom.xml <- Plugin description/configuration file of the Maven project (allows you to define the POM (Project Object Model) used by Maven).
|- plugin.xml <- Plugin definition file
|- readme.html <- Optional readme file for plugin, which will be displayed to end users
|- changelog.html <- Optional changelog file for plugin, which will be displayed to end users
|- logo_small.gif <- Optional small (16x16) icon associated with the plugin (can also be a .png file)
|- logo_large.gif <- Optional large (32x32) icon associated with the plugin (can also be a .png file)
|- src
|- classes/ <- Resources your plugin needs (i.e., a properties file)
|- database/ <- Optional database schema files that your plugin needs
|- i18n/ <- Optional i18n files to allow for internationalization of plugins.
|- lib/ <- Libraries (JAR files) your plugin needs
|- java/ <- This is the directory containing the sources of the plugin application(.java files) and located in the package
|- web <- Resources for Admin Console integration, if any
|- WEB-INF/
|- web.xml <- Generated web.xml containing compiled JSP entries
|- web-custom.xml <- Optional user-defined web.xml for custom servlets
|- images/
This is not compliant with the maven standard layout where the Java sources should be in src/main/java and not in src/java and where directories like web, lib and classes don’t have anything to do in src.
What’s the point here ? Is that still current or is the documentation outdated ?
Anyway, even puting the artifacts in the right place, for example puting the web directory in src, doesn’t seem to work as the final JAR is missing JSP, JS and other files.
Is the the maven-assembly-plugin with the standard openfire-plugin-assembly descriptor the recommended way to develop/deploy Openfire plugins with maven ? If yes, how come it doesn’t seem to work as expected with the JSP, JS, etc. ? If no, what is the recommended way to build Openfire plugins with maven ? Is there any dedicated maven plugin ? I have seen some posts refering to a maven plugin but the authors were compliying that it didn’t work.
Many thanks in advance for any help.
Kind regards,
Nicolas

Does the openfire-exampleplugin repo help any?

No, unfortunatelly it doesn’t as the resulting JAR don’t contain the required JSPs, i18n resources, the WEB-INF directory etc. Here below is the JAR content:

     0 Fri Jan 08 19:41:26 CET 2021 META-INF/
   133 Fri Jan 08 19:41:24 CET 2021 META-INF/MANIFEST.MF
     0 Fri Jan 08 19:41:24 CET 2021 org/
     0 Fri Jan 08 19:41:24 CET 2021 org/igniterealtime/
     0 Fri Jan 08 19:41:24 CET 2021 org/igniterealtime/openfire/
     0 Fri Jan 08 19:41:24 CET 2021 org/igniterealtime/openfire/exampleplugin/
     0 Fri Jan 08 19:41:24 CET 2021 org/jivesoftware/
     0 Fri Jan 08 19:41:24 CET 2021 org/jivesoftware/openfire/
     0 Fri Jan 08 19:41:24 CET 2021 org/jivesoftware/openfire/plugin/
     0 Fri Jan 08 19:41:26 CET 2021 org/jivesoftware/openfire/plugin/exampleplugin/
     0 Fri Jan 08 19:41:24 CET 2021 org/apache/
     0 Fri Jan 08 19:41:24 CET 2021 org/apache/jsp/
     0 Fri Jan 08 19:41:24 CET 2021 org/apache/jsp/tag/
     0 Fri Jan 08 19:41:24 CET 2021 org/apache/jsp/tag/meta/
     0 Fri Jan 08 19:41:24 CET 2021 org/apache/jsp/tag/meta/admin/
     0 Fri Jan 08 19:41:26 CET 2021 org/apache/jsp/tag/meta/admin/admin/
   925 Fri Jan 08 19:41:24 CET 2021 org/igniterealtime/openfire/exampleplugin/ExamplePlugin.class
  3917 Fri Jan 08 19:41:26 CET 2021 org/jivesoftware/openfire/plugin/exampleplugin/exampleplugin_002dpage_jsp$Helper.class
 21939 Tue Dec 29 18:08:18 CET 2020 org/jivesoftware/openfire/plugin/exampleplugin/exampleplugin_002dpage_jsp.class
  5600 Thu Dec 07 21:56:20 CET 2017 org/apache/jsp/tag/meta/admin/admin/infoBox_tagx.class
  6328 Thu Dec 07 21:56:20 CET 2017 org/apache/jsp/tag/meta/admin/admin/contentBox_tagx.class
     0 Fri Jan 08 19:41:26 CET 2021 META-INF/maven/
     0 Fri Jan 08 19:41:26 CET 2021 META-INF/maven/org.igniterealtime.openfire/
     0 Fri Jan 08 19:41:26 CET 2021 META-INF/maven/org.igniterealtime.openfire/exampleplugin/
  4319 Fri Jan 08 19:18:36 CET 2021 META-INF/maven/org.igniterealtime.openfire/exampleplugin/pom.xml
   134 Fri Jan 08 19:41:26 CET 2021 META-INF/maven/org.igniterealtime.openfire/exampleplugin/pom.properties

Hence, after deploy, the admin console extension doesn’t apear.
Additionally, the layout which this project uses isn’t the maven’s one.
Would you have any working example ?
Many thanks in advance.
Nicolas

Are you looking at the right jar file? When you execute mvn package you should end up with two jar files: yourplugin.jar and yourplugin-openfire-plugin-assembly.jar. The last one is your Openfire plugin (the first one only contains the compiled code, but not the Openfire-specific data).

To use the yourplugin-openfire-plugin-assembly.jar file, you’d typically rename it to yourplugin.jar (yes, that’s confusing) before uploading it to Openfire.