Get started quickly with the Plugin Maven Archetype

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

What is a Maven Archetype?

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

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

Creating your first Plugin 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 plugin 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-plugin-archetype -DarchetypeVersion=3.4.0
  • Specify the common Maven identifiers for the new project in the prompt: GroupId, ArtifactId, Version

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

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 plugin see Development with Maven Plugin.

Creating your first Plugin 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-plugin-archetype

    • Archetype Version: 3.4.0

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 plugin on HiveMQ?
The next chapter explains how to run and debug plugins within your IDE. Go directly to the IntelliJ section.

Creating your first Plugin Project using Eclipse

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

  • Go to File → New → Project 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-plugin-archetype

    • Archetype Version: 3.4.0

Add Archetype

  • Click Next, enter the desired Group Id, Artifact Id, Version for your plugin 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 plugin on HiveMQ?
The next chapter explains how to run and debug plugins within your IDE. Go directly to the Eclipse section.