3

我在 Ubuntu 12.04 上使用 Emacs 24 快照和 Scala 2.9.2 和ensime_2.9.2-RC1-0.9.3.RC4.

基本上我做了与https://groups.google.com/forum/?hl=en&fromgroups#!topic/ensime/HvvvFr5gSwg中描述的相同的事情

  • 我使用 sbt 生成 .ensime 文件ensime generate
  • 我在 Emacs 上使用M-x ensime.
  • 它正确解析所有库等(自动完成工作正常等)

但是,当我尝试在 Emacs 中使用 启动 SBT 控制台时C-c C-v s,它会显示以下错误:

[info] Loading project definition from /home/ximyu/.sbt/plugins

[info] Updating {file:/home/ximyu/.sbt/plugins/}default-86f483...

[error] a module is not authorized to depend on itself: default#default-86f483;0.0

[error] {file:/home/ximyu/.sbt/plugins/}default-86f483/*:update: java.lang.IllegalArgumentException: a module is not authorized to depend on itself: default#default-86f483;0.0

显然 ENSIME 正在寻找错误的项目定义目录。它实际上不是查看我的项目目录,而是查看~/.sbt. 有什么解决办法吗?

4

1 回答 1

2

我有同样的问题。我刚开始使用 ensime,所以我也不知道为什么会这样。此外,我对 scala 和 ensime 的了解非常有限,因此这只是解决可能更明显的问题的方法。

无论如何,这是有问题的 ensime 函数:

(defun ensime-sbt-project-dir-p (path)
  "Is path an sbt project?"
  (or (not (null (directory-files path nil "\\.sbt$")))
      (file-exists-p (concat path "/project/Build.scala" ))
      (file-exists-p (concat path "/project/boot" ))
      (file-exists-p (concat path "/project/build.properties" ))))

基本上 ensime 将使用上述函数来搜索缓冲区上方的文件夹,您可以在其中点击 Cc Cv s 以确定根项目文件夹。因此,一个简单的解决方法是简单地(空).sbt文件夹添加到包含您的 .ensime 项目描述的文件夹中。

于 2012-11-15T21:32:06.650 回答