Does anyone have a Maven POM for building Openfire Plugins?

Hi all,
The only mentions I can find in this forum or others date back to '07 when there was a maven plugin located at http://svn.reucon.net/repos/maven/plugins/maven-openfire-plugin/trunk but (a) It doesn’t seem to be there anymore and (b) I’m not sure it’s needed anymore.

Now the Openfire code is in the maven repository, I’ve been able to meet all my dependencies using Maven, but I can;t get it to build a plugin. I get build success but it’s empty so far as building a jar goes, and I’m not sure it’s packing the structure correctly.

Does anyone have a working pom.xml that I can use to build the jar correctly?

Best and thanks

Have a look at the plugins’ pom. Basically you need maven-assembly-plugin with a descriptor project.

See here:
https://github.com/igniterealtime/Openfire/tree/master/src/plugins/openfire-plugin-assembly-descriptor

In your plugin (or parent pom of all your plugins) use something like this:

<plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.6</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.igniterealtime.openfire.plugins</groupId>
                            <artifactId>openfire-plugin-assembly-descriptor</artifactId>
                            <version>${openfire.version}</version>
                        </dependency>
                    </dependencies>
                    <executions>
                        <execution>
                            <id>make-assembly</id>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                            <configuration>
                                <appendAssemblyId>false</appendAssemblyId>
                                <finalName>${plugin.name}</finalName>
                                <attach>false</attach>
                                <!-- This is where we use our shared assembly descriptor -->
                                <descriptorRefs>
                                    <descriptorRef>openfire-plugin-assembly</descriptorRef>
                                </descriptorRefs>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

That’s pretty awesome, thanks.

I changed ${openfire.version} to 4.2.0 and it seems to compile but doesn’t seem to package any classes into the jar. I’ve tried both mvn install and mvn package without luck.

Is there something I’m missing? Do I need to use a special mvn commands or put my code in a special location? I have used exactly the same structure as when I used to use the ant plugin.

Thanks so much for the code above though.

Compare your structure with Openfire’s plugins. Maybe it’s different.
Also have a look at the openfire-plugin-assembly descriptor file.

The openfire example plugin may be useful too.

The pom.xml of openfire example plugin generate two jar files.
exampleplugin.jar and exampleplugin-1.0.0-SNAPSHOT.jar.
The second one contains only the classes and the META-INF folder, none of the configuration files. While the first one contains the folders: lib, META-INF, web and i18n. It does not have the configuration files either.
Consequently none of the jar can be uploaded to openfire.