0

I have a SBT project on VirtualBox virtual machine where I have installed SBT and have my project located. I run project through virtual machine with sbt, so all the external jars are located in /root/.ivy2/ in the VM.

I have also mounted all VM drive with sshfs and routed to external jars from host as ~/dev/remote/project/root/.ivy/.

I use Eclipse/ScalaIDE from host machine, so when I open project, the IDE can't find the external jars.

How to tell Eclipse to use these jars automatically or how to work with Eclipse and projects on VM?

Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
codez
  • 1,381
  • 1
  • 18
  • 28
  • Can you show how do you map libraries/jars in Eclipse to their corresponding jars on a disk? My understanding is that it doesn't really matter where the jars come from - a mounted (from host machine) or a local (native from the guest OS) disk. – Jacek Laskowski Jan 23 '14 at 12:54
  • The problem is that sbt command "eclipse" creates .classpath file with path from VM /root, but eclipse IDE is run on host machine so the path is hosts path of mounted folder + path from VM. So, when I run "sbt eclipse" in my VM, it generates but eclipse can find those jars only if I change it to – codez Jan 23 '14 at 13:34
  • For now I have to rename manualy all /root/ to /home/codez/Dev/remote/wm1/root/ in .classpath file every time I add new dependency so Eclipse can find it. – codez Jan 23 '14 at 13:39
  • Could you remove the local Ivy2 cache directory with `rm -rf /root/.ivy2/cache` and create a *virtual* copy of it with `ln -s /home/codez/Dev/remote/wm1/root/.ivy2/cache /root/.ivy2/cache`? – Jacek Laskowski Jan 23 '14 at 14:38
  • I should've said...Could you remove the local Ivy2 cache directory on **host** (since the host is where you run Eclipse and the dependencies are on guest OS, on VM). – Jacek Laskowski Jan 23 '14 at 14:47
  • Link probably will work, if I put project in WM in another folder (not root), because now Eclipse need to be run as su to access root folder. But if there is, then I prefer more a solution that does not require to do anything in host machine. Any SBT parameter or solution that could change the way .classpath file is built. – codez Jan 23 '14 at 15:09

2 Answers2

0

sbteclipse was not created to support this use case. It might be possible to tweak the sbt settings used by the eclipse command, but you will have to dig in sbt.

Otherwise, you can create a simple sh script to "fix" the file every time your dependencies change:

sed -i 's%"/root/.ivy2/%"/home/codez/Dev/remote/wm1/root/.ivy2/%' .classpath
skyluc
  • 640
  • 4
  • 6
0

Have you tried to either:

  • modify ivysettings.xml with the cache directive
  • change the sbt script to use the -cache directive
  • change the java invocation to use the -Dsbt.ivy.home directive

To point to the mounted VM ivy cache

codeblur
  • 438
  • 1
  • 3
  • 8