4

I have tried ensime/sbt on mac os. First, I open the .scala file in project folder create from using sbt in command-line, then I ran ensime and it still work fine, but whenever I run ensime-sbt (c-c c-v s), I got

java.io.IOException: No such file or directory
at java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:883)
at xsbt.boot.Locks$.apply0(Locks.scala:34)
at xsbt.boot.Locks$.apply(Locks.scala:27)
at scala.collection.Iterable$class.$init$(Proxy.scala:32)
at xsbt.boot.Launch$ScalaProvider.<init>(Launch.scala:107)
at xsbt.boot.Launch$$anonfun$1.apply(Launch.scala:83)
at org.apache.ivy.plugins.namespace.NamespaceRule.newEntry(Cache.scala:17)
at org.apache.ivy.plugins.namespace.NamespaceRule.apply(Cache.scala:12)
at xsbt.boot.Launch.getScala(Launch.scala:85)
at xsbt.boot.Launch$.run(Launch.scala:49)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:43)
at xsbt.boot.Launch$.launch(Launch.scala:68)
at xsbt.boot.Launch$.apply(Launch.scala:14)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
    Error during sbt execution: java.io.IOException: No such file or directory

    Process sbt exited abnormally with code 1

I tried using sbt from command-line and everything works from there (compile/run/console). I'm using sbt 0.10.1 and latest binary ensime on emacs24 (2011/07/24) on mac os.

Any idea that I'm doing it wrong ?

harpo
  • 41,820
  • 13
  • 96
  • 131
Tg.
  • 5,608
  • 7
  • 39
  • 52

5 Answers5

6

I had this and after applying strace I found the issue. The ensime-sbt.el function searches up from the cwd looking for ./project/build.properties. On finding this dir/file it assumes this is the root directory.

So just create this file and this issue should disappear. Would be nice if ensime created this file by default seeing as it's a required file for the sbt function to work.

Ben Fitzgerald
  • 793
  • 1
  • 6
  • 19
5

I got the same error. This situation seems to be that sbt tried but failed to create ".sbt" and ".ivy" dir at the user's home directory. Maybe, the reason is that OS user doesn't have permission to write at the user's home directory.

Kazuhiro Sera
  • 1,822
  • 12
  • 15
  • I downloaded sbt 0.12.4 and it tries to create ~/.ivy2. In my case, ~/.ivy2 was a broken symlink. When I changed the symlink to a valid dir, sbt was able to run. – Avi Tevet May 12 '14 at 19:44
2

It's something related with permission, maybe.

I checked the Locks.scala https://github.com/harrah/xsbt/blob/0.10/launch/Locks.scala source, and guessed "file.getParentFile.mkdirs()" did no work because of permission denial.

I encountered the same problem yesterday, and got it run a minute ago, by adding sudo:

"sudo emacs xxx.scala"

shallweel
  • 21
  • 1
1

you can change sbt.ivy.home and ivy.home property. So, to augment Joachim's first solution, you would set both system properties: like this: java -Dsbt.ivy.home=/tmp/.ivy2/ -Divy.home=/tmp/.ivy2/ -jar dirname $0/sbt-launch.jar "$@"

hope to resolve you problem

stevencjh
  • 19
  • 1
-1

This error also occurs when the files in the home directory that sbt tries to access are not owned by the user that tries to run it. run a chmod 777 on the directoris in the home master and the issue will be solved.

sonal-raj
  • 119
  • 1
  • 3