简体   繁体   English

与nrepl的lein ring服务器不尊重cider-nrepl

[英]lein ring server with nrepl doesn't honour cider-nrepl

When I start up my current project with lein ring server and try to connect to it from Emacs via cider, I get the following warning: 当我使用lein ring server启动我当前的项目并尝试通过苹果酒从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> 

However, I do have a dependency for [cider/cider-nrepl "0.8.2"] in my project.clj . 但是,我的project.clj[cider/cider-nrepl "0.8.2"]的依赖项。 This is working just fine when I run lein repl and to which I can then connect just fine from cider: 当我运行lein repl时,这工作得很好,然后我就可以从苹果酒中连接好了:

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

I can see that I get two different messages from leiningen wrt. 我可以看到我从leiningen wrt得到了两个不同的消息。 nREPL, depending on how I start: nREPL,取决于我如何开始:

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

This is the output with the working cider-nrepl connection: 这是工作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

Looking at the output of lein deps :tree I don't see any problems. 看看lein deps :tree的输出lein deps :tree我没有看到任何问题。 So, my first question is whether this supposed to work, ie, if cider-nrepl should override lein ring s behavior wrt. 所以,我的第一个问题是这是否应该起作用,即cider-nrepl是否应该覆盖lein ring的行为。 to nrepl startup? nrepl启动? If so, could somebody give some advice for further troubleshooting? 如果是这样,有人可以提供一些进一步排除故障的建议吗?

Use latest lein-ring plugin version 0.9.2 and add :nrepl-middleware containing vector of nrepl-middlewares to :repl-options in your project.clj 使用最新的lein-ring插件版本0.9.2并添加:nrepl-middleware包含:nrepl-middleware矢量的nrepl-middleware到:repl-options project.clj中的:repl-options

For example, I create the project by lein new compojure-app my-app . 例如,我通过lein new compojure-app my-app创建项目。 Then, I tested it by creating a empty leiningen profile in ~/.lein/profiles.clj ex. 然后,我通过在~/.lein/profiles.clj ex中创建一个空的leiningen配置文件来测试它。 {:yolo {}} and starting ring server by lein with-profile yolo,dev ring server . {: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"]]}})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM