SBT 取决于特定的快照版本 [英] SBT depend on specific snapshot version

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

问题描述

我有多个快照版本的工件,例如 artifact-0.1-20120831.103456-5.

I have artifactory with multiple snapshots versions such as artifact-0.1-20120831.103456-5.

我的项目取决于特定的快照版本.如果我告诉 SBT 下载 0.1-20120831.103456-5 版本而不是 0.1-SNAPSHOT 更新任务失败.

My project depends on specific snapshot version. If I tell SBT to download 0.1-20120831.103456-5 version instead of 0.1-SNAPSHOT it fails on update task.

// build.sbt
libraryDependencies ++= Seq(
"com.example" % "smith" % "0.1-20120906.110133-36")

<小时>

// sbt update
[warn] ==== My Repo snapshots: tried
[warn]   http://repo.localhost/snapshots/com/example/smith/0.1-20120906.110133-36/commons-0.1-20120906.110133-36.pom

如何在 http://repo.localhost/snapshots/com/example/中制作 SBT 搜索工件smith/0.1-SNAPSHOT 目录但使用唯一的快照版本?

How to make SBT search artifacts in http://repo.localhost/snapshots/com/example/smith/0.1-SNAPSHOT directory but use unique snapshot version?

推荐答案

补充 除了唯一的版本插件,sbt 还有 aether-deploy 插件(见下文).

Addition Apart from the unique version plugin, sbt also has the aether-deploy plugin (see below).

有一个唯一版本插件,它可以让您根据需要解决工件.引自页面:

There is the unique version plugin which lets you resolve your artifacts like you want. Quote from the page:

如何指向它

"0.1.0" or "0.1.0-20120602-073010" you can always use the static version number.
"0.1.0-+" selects the latest 0.1.0 snapshot.
"latest.integration" selects the latest revision regardless of its status.
"latest.milestone" selects the latest revision with either Milestone or Release status.
"latest.release" selects the latest with the Release status.

但您还必须使用此插件发布,因为工件以与版本有关的不同方式发布:在您的示例中,工件不会存储在 0.1-SNAPSHOT 目录下,而是存储在 0.1-20120831.103456-5

But you also have to publish with this plugin, since the artifacts are published in a different manner regarding the version: In your example, the artifact won't be stored under 0.1-SNAPSHOT directory but under 0.1-20120831.103456-5

加法还有一个 aether-deploy 插件,它使用 Aether(Aether 提供了与 Maven 存储库交互的标准方式).问题是这个插件目前仅适用于部署(正如插件名称所暗示的那样).也许作者计划对其进行扩展,以便它也可以用于解析(听起来对我来说是一个有用的功能).如果您无法使用唯一版本插件发布(例如,如果快照不归您所有),那么您可以在 sbt 论坛.

Addition There is also the aether-deploy plugin which uses Aether (Aether offers a standard way of interacting with Maven repositories). Problem is that this plugin currently works for deploying only (as the name of the plugin suggests). Maybe the author has plans to extend it so that it works for resolving as well (sounds like a useful feature to me). If you can't publish with the unique version plugin (e.g. if the snapshots are not owned by you), then you could ask that at the sbt forum.

因此,我无法提供与 maven 一样适用于您的用例的解决方案,但希望它能为您和其他人提供一些有用的信息.

So I can't offer a solution that works precisely as maven does for your use case, but hopefully it gives some useful info for you and others.

这篇关于SBT 取决于特定的快照版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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