How to Create a Plugin for Maven

1) Create a mojo for every goal:

import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;

 * Sample Goal Description
@Mojo(name = "sample")
public final class SampleMojo {
   * Sample Parameter Description
  private String param;

  public void execute() {


2) Build the plugin:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

3) Run the plugin in Maven:

mvn br.eti.fernandoribeiro.sample:sample-plugin:sample

You can find more details here.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s