Maven版本发布候选版本和快照 [英] maven versions release candidates and snapshot

查看:265
本文介绍了Maven版本发布候选版本和快照的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是发布一个具有单个依赖项的项目.我有一个关系存储库,在其中部署了快照和发行版.

My goal is to release a project which have a single dependency. I have a nexus repository where i deploy both snapshot and release versions.

我有一个依赖项

group:artifact:1.1.0-SNAPSHOT

以及以下发布候选版本已在我的联系仓库中发布

and the following Release Candidate is released in my nexus repo

group:artifact:1.1.0-RC1

当要求版本插件解决依赖性时,它声称没有新的依赖性可用.所以他认为

when asking to the versions plugin to resolve the dependencies, it claims that no new dependency is available. So he consider that

1.1.0-SNAPSHOT > 1.1.0-RC1

但是,如果在我的项目中,我具有1.0.0-SNAPSHOT版本,则将1.1.0-RC1版本解析为最新版本.

However, If in my project, i have version 1.0.0-SNAPSHOT, version 1.1.0-RC1 is resolved as the newest version.

我想念什么? (我调查了插件的来源,我们有以下代码段:

What am I missing? (I looked into the plugin sources and we have the following snippet:

String otherQualifier = otherVersion.getQualifier();

if ( otherQualifier != null )
{
  if ( ( qualifier.length() > otherQualifier.length() )
      && qualifier.startsWith( otherQualifier ) )
  {
    // here, the longer one that otherwise match is considered older
    result = -1;
  }
  else if ( ( qualifier.length() < otherQualifier.length() )
      && otherQualifier.startsWith( qualifier ) )
  {
    // here, the longer one that otherwise match is considered older
    result = 1;
  }
  else
  {
    result = qualifier.compareTo( otherQualifier );
  }
}

在我看来,这是个错误.有什么主意吗?

which seems buggy to me. Any idea?

推荐答案

Maven版本号如下:

Maven version numbers are comprised as follows:

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

如果所有版本号均相等,则按字母顺序比较限定符. "RC1"和"SNAPSHOT"与"a"和"b"的排序没有不同.结果,"SNAPSHOT"被认为是较新的,因为它的字母顺序更大.请参见此页面参考.

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.

请注意,a.b.c-RC1-SNAPSHOT将被认为早于a.b.c-RC1.

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

我不确定建议什么作为解决方案-这就是Maven版本控制的工作方式.

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

这篇关于Maven版本发布候选版本和快照的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆