脱机使用SBT和SNAPSHOT依赖项 [英] Working offline with SBT and SNAPSHOT dependencies

查看:96
本文介绍了脱机使用SBT和SNAPSHOT依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的任何项目中,我都无法脱机使用SBT.现在,我处于移动中间,而托管关系的衣橱服务器处于脱机状态.

I have never been able to work offline with SBT on any of my projects. Now I'm in the middle of a move and my wardrobe-server hosting nexus is offline.

这么说吧:

sbt "set offline := true" run

我得到了其他失踪的部门:

I get among other missing deps:

[error] unresolved dependency: se.hedefalk#lift-utils_3.0_2.10;0.2-SNAPSHOT: not found

对于声明为的依赖项:

"se.hedefalk"       %% ("lift-utils_"+liftEdition) % ("0.2-SNAPSHOT"),

但是我的常春藤缓存中确实有依赖项:

But I do have the dependency in my ivy cache:

$ ll ~/.ivy2/cache/se.hedefalk/lift-utils_3.0_2.10/
total 32
drwxr-xr-x  8 viktor  staff   272B Mar 14 11:36 ./
drwxr-xr-x  5 viktor  staff   170B Mar  8 10:38 ../
drwxr-xr-x  3 viktor  staff   102B Mar 14 11:36 docs/
-rw-r--r--  1 viktor  staff   4.5K Mar  4 15:54 ivy-0.2-SNAPSHOT.xml
-rw-r--r--  1 viktor  staff   4.0K Mar  4 15:54 ivy-0.2-SNAPSHOT.xml.original
-rw-r--r--  1 viktor  staff   1.8K Mar 14 11:36 ivydata-0.2-SNAPSHOT.properties
drwxr-xr-x  3 viktor  staff   102B Mar  8 10:38 jars/
drwxr-xr-x  3 viktor  staff   102B Mar 14 11:36 srcs/

那还不够吗?整个"offline:= true"对我来说从来没有任何改变.依赖关系解析似乎曾经发生过.

Shouldn't that be enough? That whole set "offline := true" has never ever made any difference for me. The dependency resolution seems to happen before.

我真的需要立即开始工作.多年来我一直对此有疑问,但是现在我根本无法工作.

I really need to get this working now. I have had problems with this for years, but now I'm in the situation where I simply cannot work at all.

在这里: http://www.scala-sbt.org/0.13. 5/docs/Detailed-Topics/Dependency-Management-Flow.html

我读

当脱机时:= true,远程快照将不会被更新 解决方案,甚至是明确要求的更新.这应该 有效支持工作而无需连接到远程 储存库.证明其他情况的可复制示例是 赞赏.显然,更新必须已经成功运行才能进行 离线.<​​/p>

When offline := true, remote SNAPSHOTs will not be updated by a resolution, even an explicitly requested update. This should effectively support working without a connection to remote repositories. Reproducible examples demonstrating otherwise are appreciated. Obviously, update must have successfully run before going offline.

我可能对此理解不正确,但这是否表示我不应该遇到我的问题?

I probably don't understand this correctly, but is it saying I shouldn't have the problem I have?

我在使用时遇到相同的问题

I have the same problem using:

> sbt "skip in update := true" run

使用sbt 0.13.5

Using sbt 0.13.5

重新使我的仓库在线后,解决所有问题,然后将wifi设置为脱机,我可以退出sbt,然后运行它.但是,只要运行; reload; clean; compile,我就再次感到满意.而且,如果我退出,我什至无法启动sbt.例如,在我可以尝试使用依赖关系树或类似方法分析依赖关系图之前,先进行项目的依赖关系解析.即使说不在线,这也很令人烦恼,试图了解失败的传递性依赖来自何处.

After having my repo online again, resolving all deps and then just setting my wifi to offline I can exit sbt and then run it. However, just running ;reload ;clean ;compile and I'm f***ed again. And If I exit I'm not even able to start sbt at all. Dependency resolution for the project happens before I can for instance try to analyse the dependency graph with dependency-tree or similar. This is highly irritating even if not online if say, trying to understand where a failing transitive dependency comes from.

推荐答案

这似乎是很糟糕的事情,但是您可以将ivy缓存指定为ivy存储库,以便一旦下载了依赖项,就可以从缓存.

This seems like a terrible hack, but you can specify your ivy cache as an ivy repository, so that once your dependencies are downloaded, they can be resolved from the cache.

例如,您的〜/.sbt/存储库可能如下所示:

For example, your ~/.sbt/repositories could look like this:

[repositories]
  local
  maven-central
  cache: file://${user.home}/.ivy2/cache, [organisation]/[module]/ivy-[revision].xml, [organisation]/[module]/[type]s/[module]-[revision].[type]

注意:我必须显式设置常春藤和工件模式.在任何其他存储库下面添加本地缓存,以便首先尝试使用它们.

Note: I had to set the ivy and artifact patterns explicitly. Add the local cache below any other repos so they get tried first.

这篇关于脱机使用SBT和SNAPSHOT依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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