<iframe src="//www.googletagmanager.com/ns.html?id=GTM-TT8R4P" height="0" width="0" style="display:none;visibility:hidden">

Sonatype Blog

Stay updated on the latest news from the makers of Nexus

Refactoring a Multimodule Project: Nexus Book Build

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.

How to make a plugin that runs once during a build

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)

Plexus Container Five Minute Tutorial

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.

Maven Training: New Dates, New Materials, New Cities

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

We're Used to the Axe Grinding

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:

Nexus Indexer 2.0: incremental downloading

The nexus indexer has become fairly popular, and is the de-facto standard when it comes to indexing maven repositories (including the big boy, central). As repositories grow and grow, the index of artifacts grows right along with them. What was initially a small few hundred kilobyte file, will grow into 20-30 megabytes or more over time. Seeing as the index is the gateway into the contents of a repository (not for maven mind you, but for users), this is the most downloaded file, and a 20mb file being downloaded by thousands of people every day, the bandwidth costs can get pretty high. To combat this, we have introduced incremental index handling into the nexus indexer.
There are 2 parts to this, building the incremental indexes for consumers to download, and retrieving the incremental indexes from a provider.

Maven Book 0.5: Flex Chapter & PDF Improvements

We just cut the 0.5 Edition of the book... Download the PDF or Read the Book Online.

  • More readable PDF content. - Typography makes a huge difference to the readability and usability of a text like Maven: The Definitive Guide, and this edition marks a series of editions that are going to focus on bringing the PDF format of this book up to the level of the printed, post-production version of the book. In this release:
    • Font was reduced to 11 point from 14 point. In addition to saving a few trees, this makes the book easier to read.
    • Page margins reduced to 0.3 inches. Again, if you look at an old version of the PDF, you'll see that the margins were all over the place and the page wasn't even centered.
    • More sophisticated table layout. As this books develops, I expect it to grow more "useful" tables than we have now. The FlexMojos chapter is full of long reference tables for each plugin goal, and we're stating to get more sophisticated about table layout in the PDF.
  • First Version of FlexMojos Chapter Completed - Chapter 20 covers the FlexMojos plugin and how you can use Apache Maven to compile, document, test, and build Flex applications. FlexMojos just recently had a 3.2.0 release which added more support for unit testing, and the next FlexMojos release 3.3.0 is going to emphasize unit test coverage reports. The first draft of the Flex chapter covers everything you need to know about configuring your development environment for Flex to using the FlexMojos archetype to start a new Flex project in Maven.

Maven: Integration and Distributed, Open Innovation

Brian Murphy wrote a long blog post about the PAX Plugin which provides a good example of the power of Maven to act as an integration "bridge" between a number of unrelated technologies. In this post, Brian is using the PAX Maven Plugin from ops4j together with the gmaven-plugin and the maven-scala-plugin, he concludes with praise for Maven as an essential time saver:

"This ended up being a much longer article than I anticipated but we've covered a lot of ground. Maven has worked it's dependency voodoo which saved an enormous amount of time downloading jars and messing with classpaths. We've seen how the PAX toolkit from OPS4J makes creating, modifying and provisioning OSGi bundles a breeze. While the actual code examples were pretty trivial, we successfully managed to code up bundles in Java, Scala and Groovy. I think this displays a lot of the power that is offered by OSGi and points to a bright future for enterprise development on the JVM."

FlexMojos Chapter Focus of 0.5 Maven Book Release

Just wanted to give people a heads up. The FlexMojos chapter is going to be the focus of the 0.5 release of the Maven book. I got a quick request yesterday for the most recent documentation for FlexMojos 3.1.0, and it motivated me to spend some time on our Flex chapter. If you are a reader, and you are looking for more documentation, you should know that you have two options to help drive our priorities for the Maven book. You can:

GetSatisfaction is a bit more community oriented and personal, while JIRA is more direct. If you are already participating in Sonatype's open source development effort, you likely already have a JIRA account with us. Whatever you do, don't hesistate to let us know what documentation you need. We're listening.

Reading Our Work in Progress

The most recent build from the master branch of the book's GitHub project is always available here. This version of the book is updated automatically whenever changes are pushed to master. The build process is currently running on a Hudson instance that is not visible to the public, but I have a JIRA task created to move this to the public grid.sonatype.org/ci instance of Hudson. The book build currently takes about 30 minutes (eek!) this is mainly due to the fact that we build all of the languages at once and there are some lingering issues with the lifecycle that cause certain tasks to run twice. Note: The PDF of the staged version of the book is not available, if you download the PDF, you'll be downloading the released version. (If you really need the PDF of the staged version, you are welcome to build it yourself.

The 0.5 release of the book is in progress. I'd say we have about two or three days between now and the formal release. You can take a look at the remaining issues in our JIRA instance here. What remains for the 0.5 release is some documentation about Flex Unit Testing , Flex Code Coverage Tools, and a few other FlexMojos goodies. Since the 0.4 release earlier this week, we've updated the FlexMojos documentation to reflect the latest Flex archetypes and add some essential documentation about configuring your environment for unit testing: here is the latest staged version of Chapter 20

Did I mention that you should really sign up for our Chicago training yet? Because, if I didn't, I should have.

The Ulitimate Java Build System

Christopher Judd places Nexus, Hudson, and Maven in his "Ultimate Java Build System" stack:

Book Release 0.4: Password Encryption + Fixing Typos

Yesterday a minor release of the book was pushed to production. This was the first production build of the book from the Maven book's new Github repository. We build the book from the production branch of the Git repository stored here: http://github.com/sonatype/maven-guide.

To build the book, we run the release:prepare goal and then I merge the release tag into the production branch. Once the production branch has been updated, our Hudson instance will then build and push the updated version of the book to http://www.sonatype.com/books/maven-book/reference/. We use Continuous Integration to constantly build a staging version of thes book from the master branch which is published here: http://www.sonatype.com/books/maven-book-stage/reference/.