如何为SBT设置本地代理存储库? [英] How to set up a local proxy repository for SBT?

查看:164
本文介绍了如何为SBT设置本地代理存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Maven/Ivy的了解几乎为零,但知道这些技术落后于SBT自动下载和管理库的能力.

I have near zero knowledge of Maven/Ivy but know that these technologies are behind SBT's ability to download and manage libraries automatically.

当我尝试从SBT生成IntelliJ Idea项目时,它(想法或生成器插件)未能找到存储在通用Ivy 2缓存中的缓存库.我已经通过设置SBT项目以使用将已下载的库存储在项目目录下的旧方案来解决了这个问题.我的另一个项目使用旧的SBT版本,默认情况下采用这种方式.在这两种情况下,我都使用clean命令在备份之前删除库二进制文件,并在再次下载所有库之后使用update.这意味着我多次下载相同的库文件.

When I was trying to generate an IntelliJ Idea project from SBT it (Idea or the generator plug-in) has failed to find cached libraries stored in the common Ivy 2 cache. I've solved the problem by setting up the SBT project to use the old scheme storing downloaded libraries under the project directory. Another project of mine uses old SBT version which does it this way by default. In both cases I use clean command to remove library binaries before backing up and update after to download all the libraries again. Which means I download the same library files many times.

问题是如何设置本地存储库以缓存库,以便SBT更新将从可用的本地缓存中下载库?如果可能的话,最好将现有的~/.ivy2/cache目录用于缓存.

The question is how to set up a local repository to cache the libraries so that SBT update will download the libraries from the local cache if available? Would be nice to use the existing ~/.ivy2/cache directory for the cache if possible.

当您至少具备Ivy 2的基本知识时,我倾向于认为这可能相当简单.

I tend to believe this is probably fairly simple when you have at least basic Ivy 2 knowledge.

推荐答案

伊凡(Ivan),这可能会有帮助.

Ivan, this may help.

sbt
> deliver-local
[info]  delivering ivy file to /.../target/scala-2.9.1/ivy-1.0.xml

然后,您将需要查找IntelliJ等效的步骤,但是在Eclipse中,您将使用

Then, you'll need to find IntelliJ equivalent steps, but in Eclipse you configure the build path with an additional library, "IvyDE Managed Dependencies" offered by the IvyDE plugin

1) browse to the target/scala-version/ivy-1.0.xml file
2) select desired configurations (compile, runtime, test, provided, etc.)

现在,您的sbt配置有了常春藤表示.

Now you have an ivy representation of your sbt configuration.

这有一个令人讨厌的例外,它的工作非常出色:在"sbt clean"上,常春藤配置文件被炸掉,您必须重复以上操作. Eclipse项目清理保留了常春藤配置,顺便说一句.

This works wonderfully with one annoying exception: on "sbt clean", ivy config file gets blown away and you have to repeat the above. Eclipse project clean preserves ivy config, btw.

如果可以将这种方法应用于IntelliJ,请保持张贴

Keep posted if this approach can be applied to IntelliJ

这篇关于如何为SBT设置本地代理存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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