简体   繁体   English

从 ensime 运行 sbt 时出现 java.io.IOException?

[英]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.

相关问题 运行sbt失败 - java.io.IOException:设备上没有剩余空间 - Running sbt fails - java.io.IOException: No space left on device Scala Play 2.3.5-Coveralls sbt插件java.io.IOException:无法下载JavaScript - Scala Play 2.3.5 - Coveralls sbt plugin java.io.IOException: Unable to download JavaScript java.io.IOException:方案的无文件系统:hdfs - java.io.IOException: No FileSystem for scheme : hdfs SBT发布未将jar文件上传到工件(发布)java.io.IOException:对URL的PUT操作失败,状态码为400:错误的请求 - SBT publish is not uploading jar file to artifactory (publish) java.io.IOException: PUT operation to URL failed with status code 400: Bad Request 在EMR群集上运行Spark作业时发生异常“ java.io.IOException:所有数据节点均损坏” - Exceptions while running Spark job on EMR cluster “java.io.IOException: All datanodes are bad” Hadoop:java.io.IOException:传递删除或放置 - Hadoop : java.io.IOException: Pass a Delete or a Put Spark&hbase:java.io.IOException:对等重置连接 - Spark&hbase: java.io.IOException: Connection reset by peer java.io.IOException:WebSocket方法必须是GET - java.io.IOException: WebSocket method must be a GET java.io.IOException:无法运行程序“ scala”:CreateProcess错误= 2, - java.io.IOException: Cannot run program “scala”: CreateProcess error=2, 原因:java.io.IOException:文件已存在 - Caused by: java.io.IOException: File already exists
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM