我想从代码启动 nREPL 并让 Lighttable 连接到它。这是我的尝试:
(ns test
(:require [clojure.tools.nrepl.server :refer [start-server default-handler]]
[lighttable.nrepl.handler :refer [lighttable-ops]])
(:gen-class))
(defn -main
[& args]
(start-server :port 8888
:handler (default-handler lighttable-ops)))
但是,当我从 Lighttable 连接时,我得到了这个:
Jun 19, 2014 5:30:23 PM clojure.tools.nrepl.server invoke0
SEVERE: Unhandled REPL handler exception processing message {:data {:settings {:name "localhost:8888", :remote true, :client-id 67}}, :id 67, :op client.init, :session c4f51394-135e-4579-b367-a69bdcdef15e}
java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.Atom
at clojure.core$swap_BANG_.doInvoke(core.clj:2235)
at clojure.lang.RestFn.invoke(RestFn.java:529)
at lighttable.nrepl.handler$lighttable_ops$fn__6452.invoke(handler.clj:45)
at clojure.tools.nrepl.middleware$wrap_conj_descriptor$fn__491.invoke(middleware.clj:17)
at clojure.tools.nrepl.server$handle_STAR_.invoke(server.clj:18)
at clojure.tools.nrepl.server$handle$fn__803.invoke(server.clj:27)
at clojure.core$binding_conveyor_fn$fn__4145.invoke(core.clj:1910)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
我拥有的依赖项:
[org.clojure/clojure "1.6.0"]
[org.clojure/tools.nrepl "0.2.3"]
[lein-light-nrepl "0.0.18"]
如果我运行它可以工作lein repl
,但我确实需要将代码作为 jar 包分发。