Skip to end of metadata
Go to start of metadata

This page describes the maven standard for project version numbers. Maven's dependency resolution uses the project version string to correctly order project versions.

Basic Version String

The format of the version String should look like the following:

For example, the string 2.0.1-beta-1 has a major version "2", a minor version "0" a, an incremental version "1", and a qualifier "beta-1". The String "5" has only a major version and none of the other components.

Using Snapshot Versions

Maven includes a special qualifier string called snapshot. This is can be any standard version string that ends with the qualifier "-SNAPSHOT". Snapshot version are handled differently than the standard version strings in that Maven does not assume these artifacts are static. Snapshot artifacts are intended to be temporary release builds and therefore will change and/or be removed over time.

Project Version Parsing

The code used to parse a version string in Maven can be found in the public svn repository.

Sorting version numbers

When using version ranges, it is often necessary to sort several version strings to select the correct dependency version. For two valid version strings, each component of the version string is compared separately until a difference is found. For the numeric portions of the version, the higher number is considered newer than the lower version number. For the non-numeric portion of the version string (qualifier), the strings are handled as follows.

Maven 2.x used alphabetical order to sort the qualifiers. With earlier letters considered older than later letters. Thus "alpha" is considered older than "beta". And no qualifier is considered newer than any qualifier.

Maven 3 has some hard-coded qualifier strings: "alpha", "beta", "rc", "ga", etc. These are given a predetermined order. For more details, see the above links to the source.

  • No labels