Using Maven to build Openfire Plugins

Hi,

i’'ve build a small Maven plugin to build Openfire Plugins. Its a mix of the maven-war-plugin and the Jetty JSPC plugin. Usage is quite simple, just add the plugin to your POM and set packaging to “openfire-plugin”.

Currently the plugin is available from SVN at

http://svn.reucon.net/repos/maven/plugins/maven-openfire-plugin/trunk

The site is available at

http://maven.reucon.com/projects/public/maven-openfire-plugin/1.0.0-SNAPSHOT/

=Stefan

1 Like

You can actually use the maven assembly plugin - the following descriptor will create a deployable plugin.

Yes this will work for simple plugins but as you start using i18n, database scripts and JSPs you will start seeing the benefits of an all-in-one plugin

Very true - nice work btw.

Thanks a lot for this plugin!

Very nice

Thanks for the positive feedback.

As it seems to work not only for me, I’'ve released an official 1.0.0 version.

Grab it from SVN:

http://svn.reucon.net/repos/maven/plugins/maven-openfire-plugin/tags/maven-openf ire-plugin-1.0.0/

Homepage:

http://maven.reucon.com/projects/public/maven-openfire-plugin/1.0.0/

Hi,

I tried using this plugin with openfire 3.4.5 and successfully built a jar of my plugin but this jar does not deploy into openfire. Should this maven-plugin work with openfire 3.4.5?

I built the jar using the ant task from the openfire source code and using the maven-build-plugin.

Comparing the jars shows that the one built with maven-build-plugin has a different structure, Did the stucture of deploying jars change from openfire version 3.3.0 to 3.4.5 i wonder. As 3.3.0 is the openfire version the maven-build source code uses as an example.

Any advice?

best

Mark

Hi

I try to build maven openfire plugin.

While building plugin I get NullPointerException:

C:\test2\maven-openfire-plugin\tags\maven-openfire-plugin-1.0.1>mvn install

WAGON_VERSION: 1.0-beta-2


Building Maven Openfire Plugin

task-segment:


Downloading: http://commons.ucalgary.ca/pub/m2/org/codehaus/mojo/maven-buildnumber-plugin/0.9 .3/maven-buildnumber-plugin-0.9.3.pom

6K downloaded

Downloading: http://commons.ucalgary.ca/pub/m2/org/codehaus/mojo/maven-buildnumber-plugin/0.9 .3/maven-buildnumber-plugin-0.9.3.jar

13K downloaded

buildnumber:create {execution: default}

Storing buildNumber: null


FATAL ERROR


null


Trace

java.lang.NullPointerException

at java.util.Hashtable.put(Hashtable.java:396)

at org.codehaus.mojo.buildNumber.BuildNumberMojo.execute(BuildNumberMojo.java:316)

at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.j ava:443)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecyc leExecutor.java:539)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(De faultLifecycleExecutor.java:480)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycl eExecutor.java:459)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailure s(DefaultLifecycleExecutor.java:311)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(Default LifecycleExecutor.java:278)

at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExe cutor.java:143)

at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)

at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)

at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.ja va:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)

at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)

at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

at org.codehaus.classworlds.Launcher.main(Launcher.java:375)


Total time: 10 seconds

Finished at: Mon Mar 10 21:33:00 CET 2008

Final Memory: 6M/12M


Any ideas what is wrong/how can I fix the problem ?

Regards

JohnS

More reliable solution to use this plugin (thanks to Stefan).

First of all specify plugin repository in your pom.xml:

<pluginRepositories>
        <pluginRepository>
            <id>reucon</id>
            <name>reucon public repository</name>
            <url>https://nexus.reucon.com/content/repositories/opensource-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>

Secondly, specify when you want this plugin to be executed:

<build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.reucon.maven.plugins</groupId>
                <artifactId>maven-openfire-plugin</artifactId>
                <version>1.0.2-SNAPSHOT</version>
                <extensions>true</extensions>
                <!--<configuration>-->
                <!--<jspPackageName>com.example.openfire.plugins.myplugin.jsp</jspPackageName>-->
                <!--</configuration>-->
                <executions>
                    <execution>
                        <goals>
                            <goal>openfire-plugin</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

That is all. Simply run mvn clean package and you get ready for use openfire plugin.

P.S. One main assumption for usage of Stefan plugin: you must create src/main/webapp directory in your project structure, otherwise Stefan’s plugin won’t correctly assembly openfire plugin (plugin.xml won’t be copied)

Hi Temppost2,

I’m getting no luck with a build based on this POM, is it still valid?

I also tried navigating to the POM here:

https://nexus.reucon.com/content/repositories/opensource-snapshots/com/reucon/ma ven/plugins/maven-openfire-plugin/1.0.2-SNAPSHOT/maven-openfire-plugin-1.0.2-201 10225.211336-1.pom

and using that, but it fails with this error:

[INFO] Scanning for projects…

[WARNING]

[WARNING] Some problems were encountered while building the effective model for com.reucon.maven.plugins:maven-openfire-plugin:maven-plugin:1.0.2-SNAPSHOT

[WARNING] ‘build.plugins.plugin.version’ for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 62, column 9

[WARNING] ‘build.plugins.plugin.version’ for org.apache.maven.plugins:maven-source-plugin is missing. @ line 69, column 9

[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.

[WARNING] The expression ${version} is deprecated. Please use ${project.version} instead.

[WARNING]

[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.

[WARNING]

[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.

[WARNING]

[INFO]

[INFO] ------------------------------------------------------------------------

[INFO] Building Maven Openfire Plugin 1.0.2-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ maven-openfire-plugin —

[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!

[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!

[INFO] skip non existing resourceDirectory D:\Users\Mattlindsay\git\MattAndMark\openfire-plugin\src\main\resources

[INFO]

[INFO] — maven-compiler-plugin:3.1:compile (default-compile) @ maven-openfire-plugin —

[INFO] No sources to compile

[INFO]

[INFO] — maven-plugin-plugin:3.2:descriptor (default-descriptor) @ maven-openfire-plugin —

[ERROR]

Artifact Ids of the format maven-___-plugin are reserved for

plugins in the Group Id org.apache.maven.plugins

Please change your artifactId to the format ___-maven-plugin

In the future this error will break the build.

[WARNING] Using platform encoding (Cp1252 actually) to read mojo metadata, i.e. build is platform dependent!

[INFO] Applying mojo extractor for language: java-annotations

[INFO] Mojo extractor for language: java-annotations found 0 mojo descriptors.

[INFO] Applying mojo extractor for language: java

[INFO] Mojo extractor for language: java found 0 mojo descriptors.

[INFO] Applying mojo extractor for language: bsh

[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 9.658 s

[INFO] Finished at: 2015-07-21T23:17:05+01:00

[INFO] Final Memory: 9M/31M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project maven-openfire-plugin: Error extracting plugin descriptor: ‘No mojo definitions were found for plugin: com.reucon.maven.plugins:maven-openfire-plugin.’ -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException