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.