Programming Maven

Most of this book has dealt with using Maven, though you haven’t yet seen many code examples dealing with Maven customization. In fact, you haven’t seen any. This is by design, since 99 out of 100 Maven users will never need to write a custom plugin to customize Maven. There is an abundance of configurable plugins, and unless your project has particularly unique requirements, you will have to work to find a reason to write a new plugin. And a very small percentage of people who end up writing custom plugins will ever need to crack open the source code for Maven and customize a core Maven component. If you really needed to customize the behavior of Maven, you would then write a plugin. Modifying the core Maven code is as far out of scope for most developers as modifying the TCP/IP stack on an operating system; it is that abstract for most Maven users.

On the other hand, if you are going to start writing a custom plugin, you will have to learn a bit about the internals of Maven: How does it manage software components? What does a plugin do? How can I customize the lifecycle? This section answers some of those questions and introduces a few concepts at the core of Maven’s design. Learning how to write a custom Maven plugin is the gateway to customizing Maven itself. If you were wondering how to begin understanding the code behind Maven, you’ve found the proper starting place.

What Is Inversion of Control?

At the heart of Maven is an Inversion of Control (IoC) ...

Get Maven: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.