Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.io.IOException when running sbt from ensime?

Tags:

scala

sbt

ensime

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 ?

like image 313
Tg. Avatar asked Dec 13 '22 10:12

Tg.


2 Answers

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.

like image 164
Ben Fitzgerald Avatar answered Dec 15 '22 00:12

Ben Fitzgerald


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.

like image 38
Kazuhiro Sera Avatar answered Dec 14 '22 22:12

Kazuhiro Sera