You are previewing Maven: The Definitive Guide.

Maven: The Definitive Guide

Cover of Maven: The Definitive Guide by Sonatype Company Published by O'Reilly Media, Inc.

POM Syntax

The POM is always in a file named pom.xml in the base directory of a Maven project. This XML document can start with the XML declaration, or you can choose to omit it. All values in a POM are captured as XML elements.

Project Versions

A Maven project’s version encodes a release version number that is used to group and order releases. Maven versions contain the following parts: major version, minor version, incremental version, and qualifier. In a version, these parts correspond to the following format:

<major version>.<minor version>.<incremental version>-<qualifier>

For example, the version “1.3.5” has a major version of 1, a minor version of 3, and an incremental version of 5. The version “5” has a major version of 5 and no minor or incremental version. The qualifier exists to capture milestone builds such as alpha and beta releases, and the qualifier is separated from the major, minor, and incremental versions by a hyphen. For example, the version “1.3-beta-01” has a major version of 1, a minor version of 3, and a qualifier of beta-01.

Keeping your version numbers aligned with this standard will become very important when you start using version ranges in your POMs. Version ranges (introduced in the section Dependency Version Ranges,” later in this chapter) allow you to specify a dependency on a range of versions, and they are supported only because Maven has the ability to sort versions based on the version release number format introduced in this section.

If your version ...

The best content for your career. Discover unlimited learning on demand for around $1/day.