5

当我启动当前项目lein ring server并尝试通过 cider 从 Emacs 连接到它时,我收到以下警告:

; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6)
WARNING: The following required nREPL ops are not supported: 
apropos classpath complete eldoc info inspect-start inspect-refresh inspect-pop inspect-push inspect-reset macroexpand ns-list ns-vars resource stacktrace toggle-trace-var toggle-trace-ns undef
Please, install (or update) cider-nrepl 0.8.2 and restart CIDER
user> 

但是,我[cider/cider-nrepl "0.8.2"]project.clj. 这在我跑步时工作得很好,lein repl然后我可以从苹果酒中很好地连接到它:

; CIDER 0.8.2 (Java 1.7.0_51, Clojure 1.6.0, nREPL 0.2.6)
swedishchef.handler>

我可以看到我从 leiningen wrt 收到了两条不同的消息。nREPL,取决于我如何开始:

[sugarcube->swedishchef]lein ring server
See https://github.com/technomancy/leiningen/wiki/Repeatability)
Started nREPL server on port 44231

这是使用 cider-nrepl 连接的输出:

[sugarcube->swedishchef]lein repl
See https://github.com/technomancy/leiningen/wiki/Repeatability)
nREPL server started on port 38024 on host 127.0.0.1 - nrepl://127.0.0.1:38024
REPL-y 0.3.5, nREPL 0.2.6

查看lein deps :tree我没有看到任何问题的输出。所以,我的第一个问题是这是否应该工作,即是否cider-nrepl应该覆盖lein rings 行为 wrt。到 nrepl 启动?如果是这样,有人可以为进一步的故障排除提供一些建议吗?

4

1 回答 1

6

使用最新的lein-ring插件版本 0.9.2 并将:nrepl-middleware包含 nrepl-middlewares 的向量添加到:repl-options您的 project.clj

例如,我通过lein new compojure-app my-app. ~/.lein/profiles.clj然后,我通过在ex中创建一个空的 leiningen 配置文件来测试它。{:yolo {}}并通过 启动环服务器lein with-profile yolo,dev ring server

(defproject my-app "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :dependencies [[org.clojure/clojure "1.6.0"]
                 [compojure "1.1.6"]
                 [hiccup "1.0.5"]
                 [ring-server "0.3.1"]
                 [cider/cider-nrepl "0.8.2"]]
  :plugins [[lein-ring "0.9.2"]]
  :ring {:handler my-app.handler/app
         :init my-app.handler/init
         :destroy my-app.handler/destroy
         :nrepl {:start? true}}
  :repl-options {:nrepl-middleware
                 [cider.nrepl.middleware.apropos/wrap-apropos
                  cider.nrepl.middleware.classpath/wrap-classpath
                  cider.nrepl.middleware.complete/wrap-complete
                  cider.nrepl.middleware.info/wrap-info
                  cider.nrepl.middleware.inspect/wrap-inspect
                  cider.nrepl.middleware.macroexpand/wrap-macroexpand
                  cider.nrepl.middleware.ns/wrap-ns
                  cider.nrepl.middleware.resource/wrap-resource
                  cider.nrepl.middleware.stacktrace/wrap-stacktrace
                  cider.nrepl.middleware.test/wrap-test
                  cider.nrepl.middleware.trace/wrap-trace
                  cider.nrepl.middleware.undef/wrap-undef]}
  :profiles
  {:uberjar {:aot :all}
   :production
   {:ring
    {:open-browser? false, :stacktraces? false, :auto-reload? false}}
   :dev
   {:dependencies [[ring-mock "0.1.5"] [ring/ring-devel "1.3.1"]]}})
于 2015-02-27T07:43:34.210 回答