First, I’m happy to announce that the Nexus Book is now as open source as our Maven book. We made a decision about a month ago to free this content and make it available for anyone to view the source or modify the book as they see fit. All of our books are covered by a Creative Commons license, and the source is available from GitHub.
The topic of this blog post is an attempt to make more visible some of the decisions that go into the refactoring a simple project into a multimodule project. While the specifics of this project relate to docbook compilation and site publishing, the basic principles of refactoring a multi-module Maven project apply to almost every project that you will encounter in Maven.
With it’s default behavior, Maven runs a plugin invocation for each project in a multi-module build. For plugins that operate on a single project at a time, this is what the author wants.
Some plugins are what we call “aggregators” which means they actually do want all the information about the full multi-module build before execution. These plugins, when run on a tree of projects cause Maven to resolve all the children before calling the plugin’s execute() method. In this mode a plugin executes just once, but effectively on the whole tree at once. (as a side note, you never want to bind an aggregator goal in your pom as this would cause the plugin to run an n! recursive build since the lifecycle would step into each child and execute the aggregator…which would cause Maven to reresolve all the children, etc)
The goal of this blog is to show an updated and more involved example then what is currently located on the plexus site. This will cover creating a couple of components and explain the different ways to inject your dependencies. This example assumes you are using maven 2 to make your life easier.
We have some new training dates for June-October 2009, and we’re going to be adding some new cities to the mix as well:
- May 19-20, 2009, Chicago, IL
- June 9-10, 2009, Mountain View, CA
- June 23-24, 2009, Chicago, IL
- July 7-8, 2009, Mountain View, CA
- July 28-29, 2009, Boston, MA
- August 4-5, 2009, Mountain View, CA
- August 25-26, 2009, Chicago, IL
- Sept. 8-9, 2009, Mountain View, CA
- Sept. 22-23, 2009, New York, NY
- October 6-7, 2009, Mountain View, CA
- October 27-28, 2009, Chicago, IL
For more information, or to sign up go to our Training Pages
It escapes me what positive benefit people derive from dumping their accumulated angst with Maven on a blog, but it tends to happen every so often. Each of these posts tends to expose more about the person that wrote the post than about Maven itself. Here’s where I think the most recent post goes wrong: