• Maven is a software project management
and comprehension tool.
• Based on the concept of a project object
model (POM), Maven can manage a
project's build, reporting and documentation
from a central piece of information.
Web Site Reporting
Tests JAR WAR
Continuous Integration Resources
Integration Tests Deployment
Maven “versus” Ant?
(e.g. JARs, WARs, EARs, etc...)
General Purpose Tooling
Maven = Convention
• Source, Tests, Resources
• Clean, Test, Install, Package, Deploy, Site...
• But... you have to learn the conventions!
• Maven’s learning curve in a nutshell
Back to Basics
• Let’s create a JAR
• Let’s create a WAR
• Let’s link the two!
Goals and Plugins
Goal = One Word Target
e.g. clean, test, compile, deploy
Plugin = Two Word Action
e.g. compile:compile, jar:test-jar, jetty:run
• Built-in super pom.xml (in Maven install)
• Local settings.xml
• Project pom.xml (with packaging)
• Type a goal, and the lifecycle runs the
• Tip: Declare Plugin Dependencies in the Plugin!
• Local Internet
• ~/.m2/repository (ibiblio)
• Remote Artifactory
• Servers that hold released
• e.g. Artifactory, Nexus
All Star Directories
• Most complex project (business-logic)
• Conditional builds (data-migration, integration tests)
• ~20 compile, ~15 test dependencies = apx 75 resolved dependencies
• Automatic releases via Hudson, including JAR, Test JAR, attached sources,
• Build stamps SVN version # in manifest
• Database wipe and reset, including DbUnit Fixture generation as part of
clean - with data extracted from a dependency JAR
• Site documentation (auto-gen) includes Cobertura code coverage,
CheckStyle, PMD, FindBugs, full schema info for ~160 tables (including
diagrams), Javadoc (with autogen UML class diagrams)
• How many lines of XML?
786 lines (including comments)