JBoss Seam developer. Current tools/APIs: JSF, Facelets, Richfaces, JBoss AS, EJB3, JPA, Hibernate, Eclipse. Arbi has posted 6 posts at DZone. View Full User Profile

Apache Maven 2: Effective Implementation - Book Review

04.26.2010
| 6021 views |
  • submit to reddit
Published by: Packt Publishing
ISBN: 1847194540

Reviewer Ratings

Relevance:
5

Readability:
5

Overall:
4

Buy it now

One Minute Bottom Line

Not only very good coverage of the popular build and project management tool, Maven, this book is an excellent introduction to three Apache open-source frameworks in total (Maven, Continuum and Archiva).  The book uses a real project example throughout the book which makes it easy to grasp the underlying concepts and apply in your own real-world projects.  Well-written and up-to-date for Maven 2.2.1, this book is recommended for beginners and experts alike as it covers basic introductory material like dependency management in Maven as well as best practices.  If you are looking for a Maven reference book, look elsewhere.

Review

Maven is a top-level Apache Software Foundation project and a very popular open-source build and project management tool in the Java space.  The latest version as of this writing is 2.2.1. 

This review is on “Apache Maven 2: Effective Implementation” by Maria Ching and Brett Porter.  The book was published September 2009 and covers Maven 2.2.  The target audience is Java developers who want to get started with Maven.  The book also provides coverage on two additional top-level Apache projects: Archiva and Continuum.  Archiva is an open-source build artifact repository management tool.  Continuum is an open-source continuous integration and automated build server.  Both these tools are supplementary to Maven and can be used in both personal development as well as enterprise scenarios to improve your team builds.  The book uses an example project called Centrepoint which is a simple web application that consists of several modules that interacts with Maven, Archiva and Continuum.  Thus, the book is more of a how-to book rather than a reference book like previously published Maven books.  You will need JDK 5 or above and Subversion 1.4 to work the examples.

What I liked:

As a seasoned JEE developer with experience with Ant but minimal experience with Maven, I found this book to be very informative, easy-to-follow and interesting.  I liked the tutorial approach with the example web application.  This has more value than a reference book because reference books on Maven already exist and there’s always the reference documentation online. 

Right off the bat we install Maven 2.2.1 and proceed to create a new project using Maven’s simple Java web application archetype (maven-archetype-webapp).  I like computer books that provide many examples in a tutorial fashion and this book delivers in this respect.  The authors spend a good amount of time discussing Maven basics like goals, lifecycle phases, dependencies, project object model (pom.xml), archetypes, reports,  running tests, and much more.

One topic I especially liked was the using inheritance section which describes how to factor out some sections of a pom.xml to a parent POM which can be reused in a team environment, for example.  This is a very useful and time-saving feature and is covered in the Maven Best Practices chapter.  The authors also provide some guidelines in determining how modular to make your build.  You don’t want to under-modularize or over-modularize as both present problems for your build.

The overview of Archiva had a very good picture showing a high-level view of Archiva and its components, and how it interacts with other build systems.  The authors do a good job of going through, in detail, the steps involved to install Archiva as well as how to configure and deploy from Maven or a web form.

The overview of Continuum covers details on the build automation, release management, source control management, and build statistics aspects of it.  In the setting up a source repository section, there was an error in that the svnadmin command to create a new repository requires a path which already exists.  This is not made totally clear by the authors and there is an incomplete path requirement which is incorrect and took me longer than is typical to create a new repository.  We also learned about Apache James which is an open-source mail server that can be used with Continuum.  And as an added bonus, we got exposure to yet another open-source software: Jetty which is a servlet container/web server packaged with Continuum.

I liked the fact that I was exposed to several open-source technologies in this book including Maven 2, Continuum, Archiva, Jetty, James, Clirr, Sonar, SLF4J and Maestro.  It’s always nice to know what new technologies you can add to your toolset as a developer.

Typically, software technology books need to dive into a lot of detail regarding installation, configuration, and API level details.  This book does not cover API details of the Maven 2 source code (which is fine because it’s not necessary) but it does cover some best practices in the areas of reporting, configuration coverage checks and Maven best practices in general (there is an entire chapter which covers the latter).  I really liked this feature of the book because you usually need to know what the recommended guidelines and tips are so you can start your first project successfully and make sure you don’t have problems in the long-run.  Best practices covered include preparing the development environment, installation, project settings, configuring repositories, using conventions and keeping things simple.  Some advanced topics in best practices which I liked were inheritance (using a parent POM) and using modules in your builds.

I liked the fact that the authors used a sample project called Centrepoint starting early on (chapter 3) so the reader has a concrete example of how to use Maven, Continuum and Archiva with a project.  This really helped solidify the concepts and techniques used by the technologies.  It also helped understand in a concrete way how the three technologies interface and integrate with each other.

There did not seem to be too many errors or typos in the book, which of course I liked as well.

Useful sample code was provided for most of the chapters.

What I disliked:

  • No captions for the pics.  This seems to be a problem with the Packt series of tech books (the Packt Seam book I reviewed had the same issue). 
  • The book did not spend too much time covering dependencies in Maven, which is a major difference between Maven and the popular target/task-oriented build tool Ant.
  • There was no reference to Ivy which is a Java-based dependency manager (yes, it’s a Maven book but it’s good to talk about the other build tools as well so we know when to use what tool).
  • Not enough coverage of the Maven life cycle in detail with diagrams, etc.


How to improve:

To improve the book, I suggest spending more time covering dependencies and add captions to the figures.  Spend more time covering transitive dependencies in particular as well as describing where the dependencies are downloaded from (i.e. when you specify the dependency in the pom.xml, how does Maven know what URL or ftp site to download the JAR from?).  Add more content regarding Maven’s life cycle.

Conclusion:

If you are interested in getting a fine introduction to Maven 2 and related Apache open-source projects, Archiva and Continuum, then this is a perfect book for you.  The flow of the book is very good and the authors reference a single example project throughout most of the book.  This book does not provide a laundry list of mvn commands, so either check a different book or the official Maven website, http://maven.apache.org/ , for more info.  Recommended.

Additional reading:


Java Power Tools by John Ferguson Smart

http://maven.apache.org/guides/index.html

http://maven.apache.org/articles.html

Published at DZone with permission of its author, Arbi Sookazian.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)