在 IntelliJ IDEA 中更改 sbt 项目的 Ivy 缓存位置? [英] Changing Ivy Cache Location for sbt projects in IntelliJ IDEA?

查看:41
本文介绍了在 IntelliJ IDEA 中更改 sbt 项目的 Ivy 缓存位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IntelliJ 13.0.2 中有一个 Scala 项目的 sbt 0.13.2.

I have sbt 0.13.2 with a Scala project in IntelliJ 13.0.2.

我只想更改我的默认 ../.ivy2/cache 路径.

I just want to change my default ../.ivy2/cache path.

我尝试在 SBT 安装中更改 ../bin/sbt 文件中的以下条目

I tried to change following entry in ../bin/sbt file in SBT installation

-Dsbt.ivy.home=D:/IvyHome/.ivy

但没有运气.

即使在 IDE 中我也找不到更新的地方 SBT_HOME

Even in the IDE I couldn't find the place to update SBT_HOME

解决办法是什么?

推荐答案

首先你有两个 SBT 插件.您使用的 Scala 插件版本已经支持 SBT,您不需要额外的插件.我建议您首先删除额外的插件.

First of all you have two SBT plugins. The version of Scala plugin you're using already supports SBT, and you don't need an extra plugin. I recommend that you start by removing the extra plugin.

要删除非官方插件,请转到 plugins 配置并删除 SBT 插件旁边的检查.这不会完全删除插件,但会使其保持禁用状态.

To remove the unofficial plugin go to plugins configuration and remove the check next to the SBT plugin. This will not remove the plugin completely, but will keep it disabled.

一旦你只有一个插件,你可以修改缓存的位置,通过去选项,搜索sbt.您应该在 IDE 设置 中找到一个条目.

Once you have only single plugin, you can modify the location of the cache, by going to options, and searching for sbt. You should find an entry in IDE Settings.

您应该会看到 VM 参数.点击输入旁边的图标,并在最后一行添加 -Dsbt.ivy.home=D:/IvyHome/.ivy.

You should see the VM Parameters. Click the icon next to the input, and add -Dsbt.ivy.home=D:/IvyHome/.ivy in the last line.

保存所有设置后单击确定并重新启动IDE.

Click OK and restart the IDE after saving all settings.

现在您应该使用新的主位置(当然,这仅适用于从 IDE 运行的构建,如果您从控制台使用 SBT,它仍将使用旧的主设置).

Now you should be using the new home location (of course this is true only for the builds run from IDE, if you use SBT from console, it will still use an old home setting).

如上段所述.此更改不会影响从控制台运行的 SBT.这是因为默认情况下 IntelliJ 使用捆绑的 SBT.

As pointed out in the paragraph above. This change will not effect SBT ran from console. This is because by default IntelliJ uses bundled SBT.

如果您想为从控制台运行的 sbt 修改 Ivy 主页,您有几种方法可以做到这一点.

If you want to modify your Ivy home for sbt, which you run from console, you have several ways of doing that.

我认为最简单的方法是修改 SBT_HOME/conf/sbtconfig.txt 中的 sbtconfig.txt 文件(仅限 Windows - 在 Linux 上您必须修改sbtopts).

I think the simplest is to modify the sbtconfig.txt file in the SBT_HOME/conf/sbtconfig.txt (Windows only - on Linux you'd have to modify sbtopts).

在文件末尾添加-Dsbt.ivy.home=D:/IvyHome/.ivy.

另一种方法是修改 Launcher 配置,如文档

这篇关于在 IntelliJ IDEA 中更改 sbt 项目的 Ivy 缓存位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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