Making your Java Maven plugin useful

This recipe is a continuation of the preceding recipe in which we saw how to create an Apache Maven plugin in Java.

We ran an archetype:generate, a Maven command to create a Maven plugin project and modified the MyMojo.java source and the POM file. We then built, installed, and executed the plugin from the command line.

However, in a real-world scenario, in addition to what we explored in the preceding recipe, your plugin may need:

  • Support for multiple goals
  • External configuration
  • Short commands
  • Execution in build phase

In this recipe, we take this to its logical conclusion. We have a fully-functional plugin and will understand how to tweak, reconfigure, and enhance it further.

Getting ready

A prerequisite for the ...

Get Apache Maven 3 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.