Using Maven for Large Projects, Page 2
Maven is an excellent build tool, with powerful features for large projects. If that's all it did, it would be invaluable. However, in addition to its build features, Maven also has plugins that contain powerful documentation and testing features.
With a single command, you can generate a (customizable) Web site complete with Javadoc, documentation (created from XML format source documents), and a huge array of reports, including such gems as "coverage" reports (that tell you how much of your code is being tested by your unit tests), and JUnit and other test reports.
The amount of useful documentation that can be created from even a basic project is truly amazing, and the integration that Maven's plugins provide into many different existing (mostly open source) reporting and testing tools puts it all at your fingertips. It takes a bit of tweaking of configuration properties to actually get Maven to generate all of the available reports, and you will find your next build downloads a few third-party projects and tools as required to produce the reports.
Again, like everything else in Maven, the array of reports, their format, and many other features are driven from a simple file of configuration properties.
The Bigger, The Better
For large projects, Maven's power becomes even more obvious. If your project gets beyond a certain size, it only makes sense to break it into one or more dependencies—for example, a number of jars with certain services or packages in it. If nothing else, it makes build times more manageable. Although there is a mechanism is Maven to build multiple projects at once (the "reactor"), you don't often need it in my experience, once a project reaches a certain level of maturity. It tends to be more often that individual dependencies change one or a few at a time, rather than all of them at once.
With Maven, this is simple to do, and keeping track of what depends on what, and with what versions, becomes quite manageable. The project.xml file becomes the primary definition of the state of a project, and creating intermediate (snapshot) versions is straightforward. Reuse is promoted, and an overall smoother and more reliable project lifecycle can be the result.
So, if you've been considering the Maven plunge, go for it. Expect to spend a bit of time learning and experimenting, and be ready to adopt a strict and carefully thought-out versioning system for your projects. Once you're over the hump, however, in the learning curve, the rewards are well worth it.
About the AuthorMichael Nash is the president of JGlobal Limited, a software development, consulting, training and support company specializing in open source Java technologies. He is also a core developer of the Keel meta-framework, the author of two books and a number of articles and papers about next-generation web-application development with Java, and a member of the JSR-127 (JavaServer Faces) Expert Group. He can be reached at firstname.lastname@example.org.