ENSIME没有找到正确的项目定义

时间:2012-07-18 17:35:08

标签: scala ensime

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

基本上我做了与https://groups.google.com/forum/?hl=en&fromgroups#!topic/ensime/HvvvFr5gSwg

中描述的相同的事情
  • 我使用sbt ensime generate生成.ensime文件。
  • 我使用M-x ensime在Emacs上启动ENSIME。
  • 它正确解析所有库等(自动完成正常工作等)。

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

[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。任何解决方案?

1 个答案:

答案 0 :(得分:2)

我有同样的问题。我刚刚开始使用ensime,所以我真的不知道为什么会这样。另外,我对scala& amp; 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将使用上面的函数来搜索缓冲区上方的文件夹,在该文件夹中您点击C-c C-v以确定根项目文件夹。因此,轻松修复只需将添加 a(空) .sbt 文件夹放入包含.ensime项目说明的文件夹中。< / p>