3

I'm using an Emacs 24 snapshot on Ubuntu 12.04 with Scala 2.9.2 and ensime_2.9.2-RC1-0.9.3.RC4.

Basically I did the same thing as described in https://groups.google.com/forum/?hl=en&fromgroups#!topic/ensime/HvvvFr5gSwg

  • I generate .ensime file using sbt ensime generate.
  • I start ENSIME on Emacs with M-x ensime.
  • It parses all libraries and so on correctly (auto-complete works properly etc.)

However when I try to start the SBT console within Emacs using C-c C-v s, it displays the following error:

[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

Obviously ENSIME is looking at the wrong directory for project definition. Instead of looking at my project directory it is actually looking at ~/.sbt. Any solution to this?

ximyu
  • 2,489
  • 3
  • 19
  • 16

1 Answers1

2

I have the same issue. I just started with ensime, so I don't really know why this is the case either. Also, my knowlegde on scala & ensime is very limited, so this is only a work-around to something that might be more obvious.

Anyway, this is the problematic ensime function:

(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" ))))

Basically ensime will use above function to search for a folder above the buffer where you hit C-c C-v s to determine the root project folder. As such, an easy fix is to simply add a (empty) .sbt folder into the folder that contains your .ensime project description.

MHOOO
  • 633
  • 6
  • 15
  • 1
    This is actually documented in `C-h f sbt:find-root`: What worked for me was creating a `build.properties` file my project's `project` dir. – Eran Feb 16 '14 at 00:08