Apache Maven 3 Cookbook review

Apache-maven3-cookbook-image
Today I had the possibility to read the new book published by Packt Publishing, Maven 3 Cookbook, written by Srirangan; in the following post I'll shortly review the topics discussed and give my personal opinion on the book.

The book contains a good collection of recipes to start playing with Apache Maven, an Open Source build automation tool widely adopted, especially for JVM-based languages, such as Java, Scala, but also applicable to other languages, like PHP, Ruby and C#.

The book is targeted for Software Developers who want to start with Maven, therefore it is important to have a generic knowledge about Software Development and the challenges that need to be tackled when building Software; the definition of Application Lifecycle Management is good reading to start.

It is highly advised to follow this book with a laptop close to you, having a working installation of Maven 3.0.x; the first chapter of this book will guide you through the process.

Let's talk about the contents; the book can be divided in two main parts:

Introduction to Maven as a build tool and its main features and conventions, with examples and snippets

(Chapter 1 to 4) 

In my opinion these chapters, especially if targeted to a Maven newbie, lack of main concepts, such as:

  • What is the Maven Reactor
  • Properties and resource filtering
  • What is/how to use Maven archetypes

The concept of Maven Lifecycle, which I consider the most important if you need to model your build behaviors, is not extensively explained, although I think it should be necessary to understand the examples - in the second part of the book - which make use of plugin's <executions>.

I strongly advise to have a full understanding of these concepts (especially before complaining that Maven is too complex ;-) and to read Maven: The Complete Reference from Sonatype.

Nevertheless, this first part is a quick reading that allows you to setup a complete project environment using Maven in no more than 20 minutes, not bad.

Chapter 2 (Software Engineering Techniques) focuses on Maven built-in build automation, such as compilation, packaging, multi-module, reporting, code quality, unit/web testing and distribution; it is a nice and quick walk through the main features of Maven, although not extensively explained, which is good if you're starting. I liked the summary of useful commands provided by the maven-dependency-plugin, which are simply mandatory to debug your build.

Chapter 3 (Agile Team Collaboration) covers same topics of chapter 2 with a special focus on team collaboration, therefore SCM configuration, setting up a centralized Maven repository and Maven offline mode. I see many topics not related with Agile in this chapter, for example I'd have expected SCM to be categorized as a highly advisable Software Engineering Technique; I was also expecting more details on the SCM release process (maven-release-plugin explained). I liked the observations of the author regarding Distributed Development, especially the way he managed to explain important dynamics with simple words (page 67)

The extensive description on how to install Nexus and Tomcat could probably be jumped, assuming there is enough documentation on Google already for that.

Chapter 4 (Reporting and Documentation) is the one I've enjoyed the most, since it delivers practical snippets to setup your Maven site reporting, checkstlyle, javadocs and more; this is something that - within the project - tends to be forgotten/avoided/de-prioritized due to different reasons; Maven provides an extremely powerful set of tools to automatize these processes, which are properly described and tested in this chapter.

Different Maven recipes for different goals, in different languages, plus IDE integration and write your first Maven Plugin

(Chapter 5 to 9) 

In general, it's a good collection of snippets and recipes; of course you can always find nicer/better/newer snippets of the very same thing on Google and you can probably adopt them with less hassle; on the other hand, there are some extremely useful examples of technologies involving some custom configuration (see Hibernate) or a deeper understanding of the different tools involved (i.e. the Android SDK)

Chapter 5 (Java Development with Maven) explains a very nice and clean Hibernate project using hibernate3-maven-plugin and delivers a very clean structure; I wasn't extremely surprised by the configurations of Seam and Spring, very basic. Maybe I was expecting some examples on how to deliver multi-environment setup using resource filtering

Chapter 6 (Google Development with Maven) is the second chapter I've enjoyed the most (maybe because I don't have an extensive experience with Google Development platform); the entire environment setup is nicely described and allows you to be up and running in a very short time, but with full control on your build processes.

Chapter 7 (Scala, Groovy, and Flex) contains some snippets to start with the mentioned languages and use Maven as build tool; it does not provide a lot of very specific information, everything can be reached on the Web with no hassle, but it's nice to have it for completeness, especially for teams that adopt different programming languages in the same project. Maybe Clojure was worth to be mentioned.

Chapter 8 (IDE integration) provides an explanation on how to setup your IDE (if you use IntelliJ Idea, Eclipse or Netbeans) with Maven. There are many screenshots that help you with the configuration; all mentioned IDEs all provide a solid and intuitive way to configure Maven and most of the times you don't need to follow a tutorial. Nice to have it for completeness.

Chapter 9 (Extending Apache Maven) is a quick tour on how to write your own plugin using different languages; the main goal of the chapter is to make the reader aware that it is very simple to build your own plugin/behavior and that you can use different languages, but it cannot be considered a guideline for Maven Plugin Development.

Conclusions

Maven 3 Cookbook is a great contribution to the Maven Community and I am happy to have it reviewed; it does not cover everything for sure, but gives you a very quick start on Maven and remarks what are the most important aspects of a software lifecycle providing simple examples; it is definitely a nice reading for someone that has never used Maven.

From a general perspective, the book is well written, it provides a clear chapter structure and a high readability; the Maven archetypes provided by Packt are very useful and save a lot of time copy/pasting code if you want to run the examples.

The Maven expert could get a bit bored with this reading, although there are some very nice considerations and snippets, especially on Chapter 3, 4 and 6.

Although the book covers and amazing amount of topics, yet being able to keep it simple and readable, some important topics are missing; I strongly advise to deepen your Maven know-how reading also

 

Many thanks to Packt Publishing for providing me a digital copy of the book!

Filed under  //   Book   Maven   build  

About

About me

Born in Italy, living in Amsterdam.

Constantly working with Open Source technologies, I've built a strong passion for ALM and build process engineering.

Addicted to italian food and (played) football.

Hobbies: books, photography, movies, South Park, beers with friends.