2

I am developing a Authentication plugin for HiveMQ broker. I am able to integrate & bring the plugin up & running. No issue so far.

however, I have few dependency on 3rd party jars (used by the plugin itself).

How I can add them to the classpath so that those 3rd party jars are available for HiveMQ when the plugins are executed.

Thanks

param83
  • 453
  • 2
  • 6
  • 17

1 Answers1

2

The easiest way to add third party dependencies to a HiveMQ plugin is to add the dependency via Maven. Just edit the pom.xml file and add the dependencies needed. If you don't know the exact group and artifact id of your library, you can browse e.g. http://mvnrepository.com to find the correct Maven entry.

Then just package your plugin as always as described in the packaging chapter of the HiveMQ plugin development guide: http://www.hivemq.com/docs/plugins/2.2.0/#pack-deploy-chapter

Dominik Obermaier
  • 5,610
  • 4
  • 34
  • 45
  • Do I have to include my dependency jar as part of my plugin jar? (or) Refer the dependency jar from MANIFEST file of plugin jar? Can you please be more elaborative & kindly let me know the corresponding maven plugin? – param83 Feb 09 '15 at 09:43
  • param83: When you are using the maven packaging job, the dependencies jar classes are included in the plugin jar because this uses the maven shade plugin (which createds a fat jar). A good starting point for your own plugin is the HiveMQ plugin archetype (see documentation) or an example plugin on Github like this one: https://github.com/hivemq/hivemq-hello-world-plugin – Dominik Obermaier Feb 10 '15 at 12:22
  • 1
    Thanks for the update. I tried the maven plugin (shade) and able to get all the classes into one uber jar. However, things didn't work due to a custom JCE provider I use as part of my project. However, I modified run.bat to include the path to a 3rd part jars (dependency folder) like **java -Dhivemq.home=%HIVEMQ_FOLDER% -classpath C:\work\hivemq-2.2.0\dependency\*;%HIVEMQ_FOLDER%/bin/hivemq.jar com.dcsquare.hivemq.HiveMQServer** I accept your answer since it did solves the original issue. – param83 Feb 11 '15 at 16:05
  • Great to hear you got it working. Thanks for sharing your solution! – Dominik Obermaier Feb 12 '15 at 09:40