How does maven sort version numbers?

后端 未结 3 926
抹茶落季
抹茶落季 2020-11-29 02:21

Maven seems to have the ability to indicate a range of versions such as [1.2.3,) how does maven figure out what is a newer or old

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 02:36

    Your assumption about using major/minor/incremtal/ etc. is simply wrong. The comparision is done in ComparableVersion which contains the implementation. The ctor will call parseVersion(...) which uses ComparableVersion which is stored as instance in DefaultArtifactVersion and it's used during the compareTo(..)

    There are parts like getMajor.., etc. but those are not working correctly. This is the reason why will be marked deprecated.

    The information by Stehpen Collony is true for Maven 2 but not for Maven 3 anymore.

提交回复
热议问题