[英]java.io.IOException when running sbt from ensime?
I have tried ensime/sbt on mac os.我在 mac os 上尝试过 ensime/sbt。 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 (cc cv s), I got
首先,我在命令行中使用 sbt 打开项目文件夹中的 .scala 文件,然后我运行 ensime 并且它仍然可以正常工作,但是每当我运行 ensime-sbt (cc cv s) 时,我得到了
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).我尝试从命令行使用 sbt 并且一切都从那里工作(编译/运行/控制台)。 I'm using sbt 0.10.1 and latest binary ensime on emacs24 (2011/07/24) on mac os.
我在 mac os 上的 emacs24 (2011/07/24) 上使用 sbt 0.10.1 和最新的二进制 ensime。
Any idea that I'm doing it wrong?知道我做错了吗?
I had this and after applying strace I found the issue.我有这个,在应用 strace 后我发现了这个问题。 The ensime-sbt.el function searches up from the cwd looking for./project/build.properties.
ensime-sbt.el function 从 cwd 向上搜索查找./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.
如果 ensime 默认创建此文件会很好,因为它是 sbt function 工作所需的文件。
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.
这种情况似乎是 sbt 尝试但未能在用户的主目录中创建“.sbt”和“.ivy”目录。 Maybe, the reason is that OS user doesn't have permission to write at the user's home directory.
也许,原因是操作系统用户没有权限写入用户的主目录。
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 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 运行它:
"sudo emacs xxx.scala" “须藤 emacs xxx.scala”
you can change sbt.ivy.home and ivy.home property.您可以更改 sbt.ivy.home 和 ivy.home 属性。 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 "$@"因此,为了增强 Joachim 的第一个解决方案,您将设置两个系统属性:像这样: java -Dsbt.ivy.home=/tmp/.ivy2/ -Divy.home=/tmp/.ivy2/ -jar
dirname $0
/sbt-发射.jar "$@"
hope to resolve you problem希望能解决你的问题
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.当 sbt 尝试访问的主目录中的文件不属于尝试运行它的用户时,也会发生此错误。 run a
chmod 777
on the directoris in the home master and the issue will be solved.在 home master 的 directoris 上运行
chmod 777
,问题就解决了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.