SBT依赖于特定的快照版本

And*_*sov 14 scala maven sbt

我有多个快照版本的神器,如artifact-0.1-20120831.103456-5.

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

// build.sbt
libraryDependencies ++= Seq(
"com.example" % "smith" % "0.1-20120906.110133-36")
Run Code Online (Sandbox Code Playgroud)
// 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
Run Code Online (Sandbox Code Playgroud)

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

rin*_*ius 5

添加除了独特的版本插件,sbt还有aether-deploy插件(见下文).

有一个独特的版本插件,可以让你像你想要的那样解决你的工件.从页面引用:

如何指出它

"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.
Run Code Online (Sandbox Code Playgroud)

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

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

所以我不能提供一个像maven那样为你的用例工作的解决方案,但希望它能为你和其他人提供一些有用的信息.

  • 动态修订版"0.1.0- +"在开箱即用的sbt中可用,并且不需要sbt-unique-version. (2认同)