3

I'm trying to use sbt to generate an ensime configuration file as described in this tutorial:

http://jawher.net/2011/01/17/scala-development-environment-emacs-sbt-ensime/

The issue I'm having is that I cannot get sbt to generate a configuration file as the 'ensime generate' command does not appear to be part of the sbt command set.

[output]

[info] Building project ScalaTest 1.0 against Scala 2.9.2
[info]    using sbt.DefaultProject with sbt 0.7.7 and Scala 2.7.7
[error] No method named 'ensime' exists.
[info] Execute 'help' for a list of commands or 'actions' for a list of available project actions and methods.
[info] 
[info] Total time: 0 s, completed 26-Jan-2013 12:53:48
[info] 
[info] Total session time: 0 s, completed 26-Jan-2013 12:53:48
[error] Error during build.

[Steps followed]

cd <project directory> (sbt project root)
sbt 'ensime generate'

[Version info]

sbt 0.7.7
ensime 2.9.2-0.9.8.1
scala 2.9.2

[emacs configuration]

(add-to-list 'load-path "~/.emacs.d/scala-emacs")
(require 'scala-mode-auto)
(add-hook 'scala-mode-hook
            '(lambda ()
        (scala-mode-feature-electric-mode)
           ))
(require 'scala-mode)
(add-to-list 'auto-mode-alist '("\\.scala$" . scala-mode))
(add-to-list 'load-path "~/.emacs.d/ensime/elisp/")
(require 'ensime)
(add-hook 'scala-mode-hook 'ensime-scala-mode-hook)

(push "/media/xxx/Development/Runtimes/scala-2.9.2/bin/" exec-path)
(push "/media/xxx/Development/Tools/sbt/" exec-path)

Any help appreciated (I've checked all the paths so please no comments regarding this)

Cheers,

JLove

raven-king
  • 1,550
  • 2
  • 18
  • 40
  • 2
    I'd guess your version of SBT is too old (0.7.7, current release is 0.12.2). I couldn't find any explicit SBT version requirements on the Ensime github pages, but I'd be surprised if this wasn't the issue. Any reason you can't upgrade to a newer version of SBT? – Mark S Jan 27 '13 at 16:34
  • @Mark S I didn't realise that my version was sooo out of date! Thanks for the advice... I'll give it a try! – raven-king Jan 27 '13 at 17:13

3 Answers3

1

Have you added the ensime-sbt-cmd plugin to your sbt build? http://aemoncannon.github.com/ensime/index.html#tth_sEc3.1

Eugene Burmako
  • 13,028
  • 1
  • 46
  • 59
  • I had to create the file manually as it did not exist. Still not working... same error messages. I've tried adding it as a default for all projects by adding the same line to ~/.sbt/plugins/plugins.sbt (again I had to create folder structure plugins/plugins.sbt) but still no joy. – raven-king Jan 26 '13 at 18:00
1

it seems you need to quote the command on the shell i.e.:

$ sbt "ensime generate"

HTH

xkummerer
  • 21
  • 1
0

I had the same problem. After trying what you did, I solved it with these extra steps:

  1. Install the latest version (as of writing, got 0.12.3 from http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html)
  2. Edit the file project\build.properties and change the sbt.version accordingly (in my case, sbt.version=0.12.3)
  3. Run sbt from the project root.

Since you already modified the plugins file, this should install the ensime command. If you want to run it from the command line, remember to quote the command (sbt "ensime generate").

Anthon
  • 69,918
  • 32
  • 186
  • 246