Apache Maven 3 Cookbook


In my limited spare time I was reading the Apache Maven 3 Cookbook by Srirangan. It is (as the title suggests) from the Cookbook series which aims to provide answers to commons problems. One could say, it some kind of FAQ, just that it goes deeper very often. After reading the great and very useful Apache Wicket Cookbook, I have had already some expectations of this book.

Apache Maven 3 Cookbook

Looking into it, the table of content looked promising. There are chapters about basics like “set up” or “reporting”, but also on “how to develop Android with Maven” or “how to do Flex with Maven” and such. One can imagine: with just 200 pages and such a strong table of content the author wrote pretty compact. And this is actually the case. As usual in this series, you’ll be faced to a problem description first and then you’ll be guided through the solution. Srirangan does this without any additional words. Just in a few cases he let himself go as a storyteller, but these are rare occasions. No, this book is surely not inspired by Shakespeare, which is not to bad for a Cookbook.

Let’s look at the recipes. Most of them are pretty basic, or lets say “common”. The examples of these kind don’t go very deep. In short words you are explained how to set up your environment. Or what the Maven lifecycle is. Actually on some places I would have like to read more. The lifecycle for example is not to hard to understand, but honestly, two sentences as description is a bit less (after these two sentences are usual lifecycle suspects listed, but these do not explain it, they are for reference). I am not a newcomer to Maven (thanks heaven) but I imagine if you are new and have absolutely no clue, this will not really help you. Even when you know what the term “lifecycle” means, this will just show you that something happens with maven when you start it. An image would have done very well too.

The author is a bit too short with his words. This is also true for the interesting and sometimes pretty confusing part of the Maven build profiles. They are explained in short, but if you have already heard of them, you can’t learn much more of the book.

Chapter 2 is much better than the first one, because it really shows some stuff you need. It is not exactly stuff you need every day, because if you have defined PMD in your pom than, well, it is defined probably for the end of your project. But Srirangan shows some nice stuff, like dependencies from the system path.

Later he describes how to set up Nexus. Nexus is a tool with which you can create remote repositories. Thats pretty nice, but again, it is to short. There are screenshots how to install Tomcat, but how actually do I use it? With Nexus you can stage artifacts and release them, that would have been of interest. How would one use the release plugin with Nexus? But when the real interesting parts would start, the author goes already away to the next interesting topic: Hudson. Here the author writes more, explaining even the different SCM systems. There is a table about SCM which I find very confusing: its just three columns with the commands. They have no order. They have no description. They are just there because… no idea. Again, reading this chapter on Hudson I would not be able to start right away.

The reporting chapter explains (among others recipes) the site creation. It is only one recipe for it, explaining were one can put his content. But there is much more on sites. One can do skins, for example. One can do branding. One might need a copyright. One would probably love to deploy the site to a remote server. And so on. This all is missing.

Then there are the “advanced chapters”, as I call them. In one of the recipes the author explains how to create a Spring based project. Question is, if one does really need that. I mean, it is pretty straightforward to find out the right archetype for this kind of project setup. It is pretty straightforward to find out the right dependencies for it - I don’t need a whole page xml listing in a book. And for sure I don’t expect a Maven Cookbook to explain me Springs applicationContext.xml File or give me a short intro into AOP. The same is true for Hibernate and Seam.

It is a bit different when we come to Android development. This is not so well known, because Android is mostly developed with Ant - Google provides a build.xml for that. Question is, is this problem really so common it needs to go into a book for answering “common problems”? Well, it is still interesting. The author shows the plugins how to install and debug an Android application and actually I had no idea this is working.

The rest of the book is filled with “integration to technology X” recipes. So you can see how to develop Flex with Maven, or GWT, Scala and Groovy. Of course the usual IDE integrations are there too.

As a conclusion I must say this book didn’t give me too much. If you are already familiar with Maven 3, most recipes are not for you. They are simply too basic. Some other recipes are like a galactic travel: not sure where they should lead. They feel rather incomplete, like for example the recipe on Nexus. And a few are reading as they would have been compiled pretty quickly: all the integration recipes for example. Sometimes the author just says a few sentences, then a table with available goals is printed. Nothing you can’t read on the plugins web page. After all I would say, Maven Beginners can read this book, when they are willing to open the original Maven / Plugin documentation afterwards. A nice start of a book, but not complete. Remove 80% of chapter 5 - 8 and add 100 pages of other recipes to the first chapters - this is the book I would have expected and I would have loved.

Tags: #Review #Java