[ACCEPTED]-Changing Ivy Cache Location for sbt projects in IntelliJ IDEA?-sbt

Accepted answer
Score: 26

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

Two Plugins

Remove unofficial plugin

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

Disable Plugin

Change the cache location

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

IDE Settings

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

Modify Settings

Click OK and restart 15 the IDE after saving all settings.

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

Change the cache location for SBT ran from Console

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

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

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

At the end of the file add -Dsbt.ivy.home=D:/IvyHome/.ivy.

The 1 other way would be to modify Launcher Configuration as described in the documentation

Score: 4

I had the same issue with IntelliJ IDEA 7 14 Build 139.463.4 (Play Framework 2.2.5 6 project).

I followed the steps below but 5 it did not work for me. I finally fixed 4 the issue by adding to the VM Parameters 3 of the SBT Runner : -Duser.home=D:/Users/myName/ .

The 2 variable user.home is used by the SBT Launcher 1 to build ivy-home variable.

Score: 1

The answer suggesting changing IDE settings 7 essentially changed the file .idea/sbt.xml (if you made changes 6 for the project), or C:\Users\***\.IdeaIC14\config\options\project.default.xml (if you made changes 5 for the IDE default regardless which project).

Therefore, you 4 may consider putting this file in source 3 control if you need to change it frequently. (In 2 my case I had to switch between the Spark 1.4 and 1 Spark 1.5 libraries, making this worthwhile.)

More Related questions