DZone released the Maven Refcard yesterday helping you get started with one of the most popular tools among Java developers. I met the author, Matthew McCullough, to find out more about Maven, and how it's more than just a competitor to Ant.
James Sugrue: Hi Matthew, Could you please introduce yourself?
Matthew McCullough: I'm Matthew McCullough, an Open Source Architect at Ambient Ideas, LLC, a consultancy I co-founded in 1997. I enjoy both the practitioner and mentoring roles of software engineering and am currently touring with the No Fluff Just Stuff symposium series and presenting at the Colorado Software Summit.
Sugrue: How long have you been using Maven. How are you associated with the project?
McCullough: I'm a long time user of Maven -- since 1.0 Beta 8 in 2003 to be precise. The six years I've been leveraging it as a convention-over- configuration tool have been some of the most productive of my career. I'm currently providing consulting services and training around Maven and other agile practices for medium to large corporations. Accordingly, I contribute documentation, video tutorials, and occasional patches & enhancements to a range of Maven plugins.
Sugrue: Could you explain what Maven actually is?
McCullough: Maven is an open source, extensible, convention over configuration build tool with an ecosystem of plugins. These plugins offer all the standard operations of build systems such as Ant, as well as many more fringe features that specific projects have found the need to implement.
Sugrue: What would be the reason in using Maven rather than something like Ant?
McCullough: The primary reason would be its convention-over-configuration approach to the pom.xml build files. It encourages consistency across projects and minimizes script coding. A complete Java compile, test, and JAR build script can be expressed in as little as four lines of XML.
Sugrue: How do you extend, or add functionality to Maven?
McCullough: Maven has extensibility at its very core and accomplishes it through POJO-like Maven Java Objects they call "MOJOs". Simply extend one class, add an annotation, and implement getter/setter methods of your choosing and you can create any unique behavior to your build process and bind it to any phase of the Maven software compilation lifecycle.
Sugrue: Are there any tools to help create a Maven project?
McCullough: Maven offers a unique feature called "archetypes". These are very powerful project templates that can be used in an interactive manner. The user can be prompted for package names and version information. The expanded project is fully compilable and ready to be extended by the developer. Over 50 Maven archetypes are currently available for project types like Spring MVC, Wicket, Terracotta, EJBs, AppFuse and more.
Sugrue: What is your main tip for anyone getting started with Maven?
McCullough: "Maven: The Definitive Guide" is an excellent open source e-book that guides folks that are new to Maven from the basics all the way through mastery of the most advanced features. Anyone new to Maven should download and read this valuable reference.
Sugrue: What do you like most about Maven?
McCullough: The thing I like most about Maven is the convention it provides to the goals of a Java project. I can quickly join a new Java team and since they are using Maven and all of its associates standards, I can be productive on my very first day. I know without question that "mvn compile" compiles the main application code, "mvn test" builds and runs the unit tests, and "mvn package" builds the JAR. The typical time of explaining what goals I'd need to use in an Ant project are saved via Maven's standard lifecycle and goal names being the same from project to project.
Sugrue: Is the project still in development? What new features can we expect?
McCullough: Maven is in extremely active development which gives another great justification for its use. Maven 2.1 was just released, and Maven 3.0 is right around the corner. Maven 3.0 will bring faster dependency resolution, enhanced embedding in development tools, and a language- independent project definition model. A Ruby based pom file was recently prototyped by Jason van Zyl, and a YAML based pom was developed by Don Brown. Maven 3.0 has a goal of maintaining significant backwards compatibility while preparing Maven for an even more robust future by supporting more concise plugin coding.