【问题标题】:ENSIME not finding the correct project definitionENSIME 没有找到正确的项目定义
【发布时间】:2012-07-17 19:52:10
【问题描述】:

我在带有 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 文件。
  • 我在 Emacs 上使用 M-x ensime 启动 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。有什么解决办法吗?

【问题讨论】:

    标签: scala ensime


    【解决方案1】:

    我也有同样的问题。我刚开始使用 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 将使用上述函数来搜索缓冲区上方的文件夹,您可以在其中按 C-c C-v s 来确定根项目文件夹。因此,简单的解决方法是简单地添加一个(空).sbt 文件夹到包含您的 .ensime 项目描述的文件夹中。

    【讨论】:

    • 这实际上记录在C-h f sbt:find-root 中:对我有用的是在我的项目的project 目录中创建一个build.properties 文件。
    猜你喜欢
    • 2021-07-30
    • 1970-01-01
    • 1970-01-01
    • 2018-07-22
    • 1970-01-01
    • 1970-01-01
    • 2013-03-18
    • 2015-09-09
    • 1970-01-01
    相关资源
    最近更新 更多