如何为每个用户或系统范围配置 Ivy 缓存目录? [英] How to configure Ivy cache directory per-user or system-wide?

查看:19
本文介绍了如何为每个用户或系统范围配置 Ivy 缓存目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 SBT 作为构建 Scala 项目的构建工具.

I am using SBT as my build tool for building a Scala project.

我的问题是,我无法配置 SBT 将依赖项下载到我的用户主目录.因此,我正在寻找每个用户甚至更好的系统范围设置来告诉 SBT 将 Ivy 缓存目录放在其他地方.

My problem is, I can't configure SBT to download dependencies to my user home directory. Therefore I am looking for a per-user or even better a system-wide setting to tell SBT to put the Ivy cache directory somewhere else.

对于 maven,每个用户的 settings.xml 可用于配置本地存储库.

With maven there is the per-user settings.xml that can be used to configure the local repository.

我已阅读问题如何覆盖常春藤缓存的位置? 它的答案,但它似乎只描述了如何在每个项目的基础上配置设置.

I have read question How to override the location of Ivy’s Cache? and it's answers, but it seems it only describes how to configure the setting on a per project basis.

如果没有其他选择,我会选择按项目设置,但我没有从提到的问题中得到答案.欢迎提供更多详细信息,例如放置 ivysettings.xml 的位置.我把它放到项目的根目录下,还是不行.

If there is no alternative I would go for a per-project setting, but I didn't get the answer from the mentioned question to work. Some more details would be most welcome, for example where to put the ivysettings.xml. I put it into the project's root directory and it didn't work.

推荐答案

您可以简单地将环境变量添加到您的 sbt 启动 shell 脚本中:

You can simply add an environment variable to your sbt launch shell script:

java -Dsbt.ivy.home=/tmp/.ivy2/ ...

参见官方文档中的图书馆管理.

这篇关于如何为每个用户或系统范围配置 Ivy 缓存目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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