The Maven Openfire Plugin is responsible for collecting all artifact dependencies, classes and resources of an Openfire plugin and packaging them into a jar suitable for deployment to an Openfire XMPP server.
This plugin is based on the Maven WAR Plugin and the Jetty JSPC Plugin.
The Maven Openfire Plugin is currently only available in source from SVN at http://svn.reucon.net/repos/maven/plugins/maven-openfire-plugin/.
To install the plugin check it out from and call mvn install
svn co http://svn.reucon.net/repos/maven/plugins/maven-openfire-plugin/trunk maven-openfire-plugin cd maven-openfire-plugin mvn clean install
Your plugins will depend on openfire.jar which is part of the Openfire distribution but not yet available through the official maven repositories so you have to install it manually to your local repository.
mvn install:install-file -DgroupId=org.igniterealtime.openfire -DartifactId=openfire \
-Dversion=3.3.1 -Dpackaging=jar -DgeneratePom=true \
-Dfile=/opt/openfire/lib/openfire.jarThis asumes you have installed Openfire 3.3.1 in /opt/openfire.
Your project layout should conform to the maven standard with some extensions for Openfire:
myplugin
|- pom.xml <- Maven POM
`-- src
`-- main
|-- database <- Optional database scripts for your plugin
|-- i18n <- Optional resources bundles for i18n
| (must be called myplugin_i18n.properties)
|-- resources <- Optional additional resources for your plugin
|-- java <- Java source code for your plugin
| `-- com
| `-- mycompany
| `-- *.java
|-- openfire
| |-- plugin.xml <- Plugin definition file
| |-- readme.html <- Optional readme file for plugin
| |-- changelog.html <- Optional changelog file for plugin
| |-- logo_small.png <- Optional small (16x16) icon associated with the plugin
| `-- logo_large.png <- Optional large (32x32) icon associated with the plugin
`-- webapp
|-- *.jsp <- JSPs your plugin uses for the admin console
|-- images <- Any images your JSP pages need (optional)
`-- WEB-INF
`-- web.xml <- Deployment descriptor for custom servletsTo use this plugin you must set the packaging of your maven project to openfire-plugin and include the plugin in its pom.xml. You should also set the JDK to at least 1.5 as thats what Openfire requires anyway:
<project>
[...]
<groupId>com.example.openfire.plugins</groupId>
<artifactId>myplugin</artifactId>
<packaging>openfire-plugin</packaging>
<version>1.0-SNAPSHOT</version>
[...]
<dependencies>
<dependency>
<groupId>org.igniterealtime.openfire</groupId>
<artifactId>openfire</artifactId>
<version>3.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>com.reucon.maven.plugins</groupId>
<artifactId>maven-openfire-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<jspPackageName>com.example.openfire.plugins.myplugin.jsp</jspPackageName>
</configuration>
</plugin>
</plugins>
</build>
[...]The jspPackageName property is optional and specifies the Java package name to use for your JSP classes. It defaults to ${pom.groupId}.jsp.
Your Openfire Plugin specific files like plugin.xml, readme.html and changelog.html are placed into src/main/openfire. They are filtered so you can reuse meta information from your POM there. A simple plugin.xml might look like this:
<plugin>
<!-- Main plugin class -->
<class>com.example.openfire.plugins.myplugin.MyPlugin</class>
<!-- Plugin meta-data -->
<name>${pom.name}</name>
<description>${pom.description}</description>
<author>${pom.organization.name}</author>
<version>${pom.version}</version>
<date>${openfire-plugin.build.date}</date>
<minServerVersion>3.3.0</minServerVersion>
<licenseType>gpl</licenseType>
<!-- Admin console meta-data -->
<adminconsole>
</adminconsole>
</plugin>${openfire-plugin.build.date} is a special property provided by the plugin that contains the build date in the format required by Openfire ("MM/dd/yyyy").
If your Openfire Plugin contains database scripts, place them into src/main/database and src/main/database/upgrade.
Note that your i18n properties and database scripts must have the name of your plugin. If your plugin is called "my-plugin" your properties would be called my-plugin_i18n.properties, my-plugin_i18n_de.properties, etc. Your database scripts would be called my-plugin_mysql.sql, my-plugin_hsql.sql, etc.
Now you are ready to build your Openfire plugin by simply calling mvn install from the top level directory of your plugin (where your pom.xml is):
mvn clean install
Your plugin is now available in your local maven repository and in the target directory.