简体   繁体   English

使用sbt从不同的解析器检索最新的SNAPSHOT

[英]Retrieve most recent SNAPSHOT from different resolvers with sbt

I am writing an application using play 2.2.1 with sbt 0.13.0. 我正在使用play 2.2.1和sbt 0.13.0编写应用程序。 In this application I have a dependency to another project which is a snapshot and to which I also make some modifications. 在此应用程序中,我依赖于另一个项目,该项目是快照,并且还对其进行了一些修改。 If I build that project it is written to my local Maven repository. 如果我构建该项目,则会将其写入本地Maven存储库。 But normally that project should be retrieved from a private online Maven repository. 但通常应从私有的在线Maven存储库中检索该项目。

How can I configure sbt to always retrieve the newest version of the snapshot, regardless if it has to be retrieved from my local Maven repository or the online Maven repository. 我如何配置sbt以始终检索快照的最新版本,而不管是否必须从本地Maven存储库或联机Maven存储库中检索快照。

Till now I added this to my build.sbt: 直到现在,我将此添加到我的build.sbt中:

resolvers += "Online Repo" at "https://online-repo.com/somePath"
resolvers += "Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/" 
libraryDependencies += "com.some.project" % "a-project" % "2.0-SNAPSHOT"

The problem with this is that the project is retrieved from the first resolver. 问题是从第一个解析器检索项目。 In this case "Online Repo". 在这种情况下,“在线回购”。 Although the Snapshot in "Local Maven Repository" could be newer. 尽管“本地Maven存储库”中的快照可能较新。

How can I configure sbt to always retrieve the newest version of the snapshot, regardless if it has to be retrieved from my local Maven repository or the online Maven repository. 我如何配置sbt以始终检索快照的最新版本,而不管是否必须从本地Maven存储库或联机Maven存储库中检索快照。

According to Dependency Management Flow : 根据依赖性管理流程

update resolves dependencies according to the settings in a build file, such as libraryDependencies and resolvers. update根据构建文件中的设置来解析依赖关系,例如libraryDependencies和resolvers。

and

Directly running the update task (as opposed to a task that depends on it) will force resolution to run, whether or not configuration changed. 无论配置是否更改,直接运行更新任务(而不是依赖于更新任务的任务)将强制运行解析。 This should be done in order to refresh remote SNAPSHOT dependencies. 为了刷新远程SNAPSHOT依赖关系,应该这样做。

which means that SBT does this by design. 这意味着SBT是设计使然。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM