There's been a 'build tool' war in the Java community for many years. On one side are fans of Ant, the original Java script-and-build toolkit. On the other side are users of Maven, a newer kit with an emphasis on dependency management and a predefined lifecycle. The battle has been waged fiercely for quite a while.
It looks to me as if the Maven side has taken the upper hand. I try to be pragmatic about such things, but must admit that I have had some difficult times with Maven. For simple projects (based on examples from the internet, called archetypes) it's a great tool. But Maven is a two-edged sword: For every simple archetype I've benefited from, I've had a more complicated project that caused me some problem that required hours of research to solve or at least the rebuilding of my local repository. Maven can be somewhat mysterious at inopportune times.
Maven also has a giant appetite for artifacts it pulls from the internet. Pull any Maven-based open source project onto your machine some time and kick off a build cycle. If it's any kind of project at all, you'll be horrified by the number or things Maven fetches from the internet. (Ant most likely would have referred to a /lib directory that had everything cached for you. But there are pros and cons to this.)
Given this situation, I was delighted to lay hands on a copy of "Mastering Apache Maven 3" so I could learn more about this build monster. I was not disappointed.
The book covers a lot of ground. You are given knowledge of how the build cycle works and definitions for all the involved terminology ("Mojo", "plugin", "phase", "lifecycle", "assembly", etc.) Different chapters are devoted to some of the things I always thought would be cool to understand: Writing plugins, associating them with a given part of the build cycle, writing my own archetype, setting up a Nexus repository, etc. It turns out Maven is really a framework for running arbitrary code plugins-- cool! Pretty much every question I had about Maven is at least touched upon in this book. The author gives us decent examples of not only how to configure Maven, but also how to extend it. I thought this was excellent.
If the book has a shortcoming, it would be that it's a little low on illustrations. Reading page after page about a build tool (with accompanying configuration XML!) can be tedious. Just a few stick drawings or sequence diagrams would have gone a long way towards helping the reader get immediate context about what is being discussed. That's about the only harsh criticism I have for this book. For the most part, it's a very good book and will no doubt be one I'll reach for on occasion as I battle Maven in my day-to-day duties.
- Who would I recommend this book for?
- Any enterprise Java developer.
- Is it a great book?
- It's not a page turner, but it's likely to be a treasured resource.
- Will it stay relevant for long?
- Given the length of the Ant/Maven battle, I'd guess a very long time.
The book can be found here.