解决 Ivy 依赖版本顺序 [英] Resolve Ivy dependency version order

查看:23
本文介绍了解决 Ivy 依赖版本顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的构建工件存储库中,我有来自分支和主干的构建.

In my build artifact repository, I have builds from both a branch and a trunk.

我已经测试过我的解析对分支有效,并抓取了正确的项目.

I have tested that my resolve works to the branch, and grabs the correct item.

但是如果依赖项也在主干存储库中,这将不起作用.在这种情况下,它从主干而不是我的分支中获取依赖项.

But this doesn't work if the dependency is also in the trunk repo. In this case it grabs the dependency from the trunk and not my branch.

如果依赖项不在分支中,我需要从主干存储库中提取依赖项,但如果依赖项在分支中,我需要分支版本,而不是主干版本.

I need resolve to pull a dependency from the trunk repo if it's not in the branch, but if the dependency is in the branch, I need the branch version, not the trunk version.

我怎样才能在 Ivy 中做到这一点?我更喜欢它只是找到分支版本,然后停止寻找它.这样,如果它从分支中丢失,它就会落入"主干版本.

How can I do this in Ivy? I'd prefer it to just find the branch version, then stop looking for it. That way if it's missing from the branch, it "falls through" to the trunk version.

在这种情况下,我使用内部版本号的方式是否可能不正确?

Is it possible the way I am using build numbers is incorrect for this situation?

这是一个例子:

trunkbuild - version = "1.0.4"branchbuild - version = "1.0-SNAPSHOT"

trunkbuild - version = "1.0.4" branchbuild - version = "1.0-SNAPSHOT"

我的分支应该是1.1-SNAPSHOT"吗?

Should my branches be "1.1-SNAPSHOT" instead?

我的分支中的代码应该始终是 AHEAD 的版本,而不是在主干后面.

The code in my branches should always be a version AHEAD, not behind the trunk.

推荐答案

我认为您正在寻找的是动态修订:

I think it's dynamic revisions is what you're looking for:

<dependency org="mygroup" name="myartifact" revision="latest.release"/>
<dependency org="mygroup" name="myartifact" revision="latest.integration"/>

Maven 仓库支持两种基本类型的仓库:

Maven repositories supports two basic types of repository:

  • 发布
  • 快照

只有在我的主干分支上构建的工件才会发布到 Release 存储库.

Only artifacts built on my trunk branch are published to the Release repository.

因此,以下 ivy 解析器设置应该足以使其正常工作,latest.integration"解析为快照存储库中的工件.

So the following ivy resolver setup should be enough to get it working, with "latest.integration" resolving to artifacts in the snapshots repo.

<ivysettings>
    <settings defaultResolver="default"/>
    <resolvers>
        <chain name="default">
            <ibiblio name="nexus-central" root="http://myhost/nexus/content/repositories/central" m2compatible="true"/>
            <ibiblio name="nexus-releases" root="http://myhost/nexus/content/repositories/releases" m2compatible="true"/>
            <ibiblio name="nexus-snapshots" root="http://myhost/nexus/content/repositories/snapshots" m2compatible="true"/>
        </chain>
    </resolvers>
</ivysettings>

注意:

您可以在存储库管理器中创建一个存储库组,并将 ivy 设置简化为单个 URL.

You could create a repository group within your repository manager and simplify the ivy setup to a single URL.

这篇关于解决 Ivy 依赖版本顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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