Apache Maven Create a Maven Plugin


Maven allows you to implement and use custom plugins. These plugins allow additional behaviour to be bound to any phase of the Maven lifecycle.

Each Maven goal is created by implementing a MOJO (Maven Ordinary Java Object): a Java class implemented with annotations that describes how to invoke it.

The goal prefix of a plugin is derived from its artifact name. An artifact hello-world-plugin creates a goal prefix hello-world. The hello goal can then be run with mvn hello-world:hello.


A Maven plugin is a JAR containing a maven/plugins.xml that describes the plugin metadata. This file is generated by the maven-plugin-plugin.