Creating a HiveMQ Extension

So if you just read the theoretical parts of the documentation or you want to dive into the extension development quickly, you should read this chapter carefully. It will explain what a Maven Archetype is, how you can benefit from it and how to use it.

For a quick walk-through of the HiveMQ Extension SDK make sure you read our Quickstart tutorial.

What is a Maven Archetype?

A Maven archetype is a template tooling, which allows the creation of a template for a Maven project. This template can then be used to create a new Maven project. So in short the HiveMQ Extension Archetype provides you with a fully functional HelloWorld extension to get started with developing your own extensions. This is by far the simplest way to get started with extension development. If you want to gain more insights on Maven and/or the Maven archetype, please refer to the official Maven guides and the archetype guide.

Maven Central
All HiveMQ dependencies, including the maven archetype, are available in Maven central.


Creating your first Extension Project from the command line

  • Open a terminal and switch to the folder in which you want to create a new project folder with the extension source files.

Project Structure
The generation process will create a folder with all the necessary files inside the directory in which the following command is executed.
  • Make sure you have Apache Maven available (for instructions look here)

  • Execute Archetype command

    Generate a new Maven project with the archetype
    mvn archetype:generate -DarchetypeGroupId=com.hivemq -DarchetypeArtifactId=hivemq-extension-archetype -DarchetypeVersion=4.1.1
  • Specify the common Maven identifiers for the new project in the prompt: GroupId, ArtifactId, Version

  • Congrats, you have just created your first HiveMQ extension :)

Next Steps
If you want to learn more about the generated HelloWorld example, please read the provided JavaDoc. For information on how to run and debug your new extension see Development with Maven Extension.




Creating your first Extension Project using IntelliJ IDEA

  • Go to File → New Project and select Maven

  • In the next step click Add archetype... and fill in the details

    • Archetype Group Id: com.hivemq

    • Archetype Artifact Id: hivemq-extension-archetype

    • Archetype Version: 4.1.1

Add Archetype

  • Click OK and select the Archetype in the list

Select Archetype and enter own GroupId

  • Done! IntelliJ is now creating the project and resolving the Maven dependencies.

Finished project

Want to run your newly created extension on HiveMQ?
The next chapter explains how to run and debug extensions within your IDE. Go directly to Deployment and Development




Creating your first Extension Project using Eclipse

  • Make sure you have the Eclipse IDE for Java Developers, otherwise Maven is not included by default

  • Go to FileNewProject and select Maven Project

  • In the next step click Add archetype…​ and fill in the details

    • Archetype Group Id: com.hivemq

    • Archetype Artifact Id: hivemq-extension-archetype

    • Archetype Version: 4.1.1

Add Archetype

  • Click Next, enter the desired Group Id, Artifact Id, Version for your extension and click Finish

Select Archetype in list

  • Done! Eclipse will create the project and resolve all dependencies!

Finished project

Want to run your newly created extension on HiveMQ?
The next chapter explains how to run and debug extensions within your IDE. Go directly to Deployment and Development