For too long, developers have worked on disorganized application projects, where every part seemed to have its own build system, and no common repository existed for information about the state of the project. Now there's help. The long-awaited official documentation to Maven is here.
Written by Maven creator Jason Van Zyl and his team at Sonatype, Maven: The Definitive Guide clearly explains how this tool can bring order to your software development projects. Maven is largely replacing Ant as the build tool of choice for large open source Java projects because, unlike Ant, Maven is also a project management tool that can run reports, generate a project website, and facilitate communication among members of a working team.
To use Maven, everything you need to know is in this guide. The first part demonstrates the tool's capabilities through the development, from ideation to deployment, of several sample applications -- a simple software development project, a simple web application, a multi-module project, and a multi-module enterprise project.
The second part offers a complete reference guide that includes:
The POM and Project Relationships
The Build Lifecycle
Plugins
Project website generation
Advanced site generation
Reporting
Properties
Build Profiles
The Maven Repository
Team Collaboration
Writing Plugins
IDEs such as Eclipse, IntelliJ, ands NetBeans
Using and creating assemblies
Developing with Maven Archetypes
Several sources for Maven have appeared online for some time, but nothing served as an introduction and comprehensive reference guide to this tool -- until now. Maven: The Definitive Guide is the ideal book to help you manage development projects for software, web applications, and enterprise applications. And it comes straight from the source.
Introduction
Chapter 1 Introducing Apache Maven
Convention over Configuration
A Common Interface
Universal Reuse Through Maven Plugins
Conceptual Model of a “Project”
Is Maven an Alternative to XYZ?
Comparing Maven and Ant
Summary
Chapter 2 Installing and Running Maven
Verify Your Java Installation
Downloading Maven
Installing Maven
Testing a Maven Installation
Maven Installation Details
Getting Help with Maven
Using the Maven Help Plugin
About the Apache Software License
Maven by Example
Chapter 3 A Simple Maven Project
Introduction
Creating a Simple Project
Building a Simple Project
Simple Project Object Model
Core Concepts
Summary
Chapter 4 Customizing a Maven Project
Introduction
Defining the Simple Weather Project
Creating the Simple Weather Project
Customize Project Information
Add New Dependencies
Simple Weather Source Code
Add Resources
Running the Simple Weather Program
Writing Unit Tests
Adding Test-Scoped Dependencies
Adding Unit Test Resources
Executing Unit Tests
Building a Packaged Command-Line Application
Chapter 5 A Simple Web Application
Introduction
Defining the Simple Web Application
Creating the Simple Web Project
Configuring the Jetty Plugin
Adding a Simple Servlet
Adding J2EE Dependencies
Conclusion
Chapter 6 A Multimodule Project
Introduction
The Simple Parent Project
The Simple Weather Module
The Simple Web Application Module
Building the Multimodule Project
Running the Web Application
Chapter 7 Multimodule Enterprise Project
Introduction
The Simple Parent Project
The Simple Model Module
The Simple Weather Module
The Simple Persist Module
The Simple Web Application Module
Running the Web Application
The simple-command Module
Running simple-command
Conclusion
Maven Reference
Chapter 8 Optimizing and Refactoring POMs
Introduction
POM Cleanup
Optimizing Dependencies
Optimizing Plugins
Optimizing with the Maven Dependency Plugin
Final POMs
Conclusion
Chapter 9 The Project Object Model
Introduction
The POM
POM Syntax
Project Dependencies
Project Relationships
POM Best Practices
Chapter 10 The Build Lifecycle
Introduction
Package-Specific Lifecycles
Common Lifecycle Goals
Chapter 11 Build Profiles
What Are They For?
Portability Through Maven Profiles
Profile Activation
External Profiles
Settings Profiles
Listing Active Profiles
Tips and Tricks
Summary
Chapter 12 Maven Assemblies
Introduction
Assembly Basics
Overview of the Assembly Descriptor
The Assembly Descriptor
Controlling the Contents of an Assembly
Best Practices
Summary
Chapter 13 Properties and Resource Filtering
Introduction
Maven Properties
Resource Filtering
Chapter 14 Maven and Eclipse: m2eclipse
Introduction
m2eclipse
Installing the m2eclipse Plugin
Installing Prerequisites
Installing Subclipse
Installing Mylyn
Installing AspectJ Development Tools (AJDT)
Installing the Web Tools Platform (WTP)
Installing m2eclipse
Enabling the Maven Console
Creating a Maven Project
Checking Out a Maven Project from SCM
Creating a Maven Project from a Maven Archetype
Creating a Maven Module
Create a Maven POM File
Importing Maven Projects
Importing a Maven Project
Materializing a Maven Project
Running Maven Builds
Working with Maven Projects
Adding and Updating Dependencies and Plugins
Creating a Maven Module
Downloading Source
Opening Project Pages
Resolving Dependencies
Working with Maven Repositories
Searching For Maven Artifacts and Java classes
Indexing Maven Repositories
Using the Form-Based POM Editor
Analyzing Project Dependencies in m2eclipse
Maven Preferences
Summary
Chapter 15 Site Generation
Introduction
Building a Project Site with Maven
Customizing the Site Descriptor
Site Directory Structure
Writing Project Documentation
Deploying Your Project Web Site
Customizing Site Appearance
Tips and Tricks
Chapter 16 Repository Manager
Introduction
History of Nexus
Installing Nexus
Downloading Nexus from Sonatype
Installing Nexus
Running Nexus
Post-Install Checklist
Startup Scripts for Linux
Add Nexus as a service on Red Hat, Fedora, and CentOS
Add Nexus as a service on Ubuntu
Running Nexus Behind a Proxy
Using Nexus
Browsing Repositories
Browsing Groups
Searching for Artifacts
Browsing System Feeds
Browsing Log Files and Configuration
Changing Your Password
Configuring Maven to Use Nexus Repositories
Using the Nexus Central Proxy Repository
Using Nexus for Snapshot Repositories
Adding Custom Repositories for Missing Dependencies
Adding a New Repository
Adding a Repository to a Group
Configuring Nexus
Customizing Server Configuration
Managing Repositories
Managing Groups
Managing Routes
Managing Scheduled Services
Managing Security
Managing privileges
Managing repository targets
Managing security roles
Managing users
Network Configuration
Maintaining Repositories
Uploading Artifacts to Hosted Repositories
Deploying Artifacts to Nexus
Configuring Deployment Security
Deploying Releases
Deploying Snapshots
Deploying Third-Party Artifacts
Chapter 17 Writing Plugins
Introduction
Programming Maven
Plugin Descriptor
Writing a Custom Plugin
Mojo Parameters
Plugins and the Maven Lifecycle
Chapter 18 Writing Plugins in Alternative Languages
Sonatype Company is Jason Van Zyl's company and pretty much the center of the Maven universe. Jason Van Zyl is the inventor and lead developer of Maven.
Comments about oreilly Maven: The Definitive Guide:
This book simply did a top-notch job of getting me familiar with Maven and then showing me the right way to use it effectively. It was not only smart in its organization but so well-written and illustrated with excellent examples that it made me *want* to use Maven immediately.
In other words, if you've gotten this far, just buy the book. It's a really good one.
11/29/2008
(10 of 11 customers found this review helpful)
2.0
Good book but full of code errors
By Mustang
from Undisclosed
Comments about oreilly Maven: The Definitive Guide:
Approach: 5 stars
Examples: 5 stars
Material: 5 stars
Code quality: 1 star
Loss of time due to fixing stupid errors: -2 stars
The book really deserves much better but I'm VERY glad that I did not pay for that. Because it took me a lot of time trying to work the examples out. The book is available online at the company's site as well as Safari. I'd really be disappointed if I bought this book in print.
My point is simple. I want to learn maven. I want to be able to get deep. So while reading the books examples, I avoid using an IDE.
What happens when you don't use an IDE and use an editor instead? You don't get feedback on syntax errors, type checing errors package names etc.
Well I want to learn Maven not java. I know java. I expect the sample code to work. So I copy and paste the code. That's where the problems starts.
There are so many errors even in simple pom.xml snippets.
How could you miss closing tags in a 5 line XML?
Bottomline, material is good, code quality is lousy. I wouldn't expect this from an O'Reilly book.
10/1/2008
(1 of 2 customers found this review helpful)
5.0
Awesome resource
By Anonymous
from Undisclosed
Comments about oreilly Maven: The Definitive Guide:
Very helpful, this book pretty much answers all of my questions about Maven. Thanks for making so much of it openly available as well.