maven versions release candidates and snapshot

余生颓废 提交于 2019-12-04 05:51:01

Maven version numbers are comprised as follows:

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

If all the version numbers are equal, the qualifier is compared alphabetically. "RC1" and "SNAPSHOT" and sorted no differently to "a" and "b". As a result, "SNAPSHOT" is considered newer because it is greater alphabetically. See this page as a reference.

Note that a.b.c-RC1-SNAPSHOT would be considered older than a.b.c-RC1.

I'm not sure what to suggest as a solution - this is just how Maven versioning works.

Specs only work with major.minor.increment-qualifier with qualified compared by lexigographical order, independently from beeing snapshot or whatever.

I ended up forking maven-versions-plugin and implementing my own versions scheme which consider that a snapshot version of a release candidate is always older that the release candidate itself.

This wasn't too hard to implement, I extended from

org/codehaus/mojo/versions/ordering/MavenVersionComparator 

and declared by own class in

org/codehaus/mojo/versions/ordering/VersionComparators.java

and implemented my own business logic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!