[英]How to upgrade nrepl version of leiningen?
I'm using leiningen
and emacs
+ cider
for clojure development. 我正在使用
leiningen
和emacs
+ cider
进行clojure开发。 A few days ago, after I upgrade cider
through emacs package manager, I'm getting the following warning message when I run Mx cider-connect
or Mx cider-jack-in
. 几天前,在我通过emacs包管理器升级
cider
之后,当我运行Mx cider-connect
或Mx cider-jack-in
时,我收到以下警告消息。
; CIDER 0.9.0snapshot (package: 20150222.137) (Java 1.8.0_31, Clojure 1.6.0, nREPL 0.2.6)
WARNING: CIDER requires nREPL 0.2.7 to work properly
user>
The warning message clearly says that I have to upgrade nrepl to 0.2.7, however, I don't know how. 警告信息明确表示我必须将nrepl升级到0.2.7,但是,我不知道如何。
I installed leiningen
via brew
, and it uses nrepl 0.2.6
. 我通过
brew
安装leiningen
,它使用nrepl 0.2.6
。
$ lein repl
nREPL server started on port 53218 on host 127.0.0.1 - nrepl://127.0.0.1:53218
REPL-y 0.3.5, nREPL 0.2.6
Clojure 1.6.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=>
The content of leiningen profile is: leiningen简介的内容是:
{:user {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]}}
Question: : How to upgrade the version of nrepl used by leiningen? 问题:如何升级leiningen使用的nrepl版本?
I've just had this problem, and I solved it by adding an explicit dependency on the newer version of tools.nrepl
to profiles.clj
. 我刚刚遇到这个问题,我通过在较新版本的
tools.nrepl
对profiles.clj
的显式依赖来解决它。 My ~/.lein/profiles.clj
: 我的
~/.lein/profiles.clj
:
{:repl {:plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]]
:dependencies [[org.clojure/tools.nrepl "0.2.7"]]}}
No idea whether that's the best or official way to do it, tho'. 不知道这是最好的还是官方的方式来做到这一点。
an additional note on top of @matthew-moss's: the tools.nrepl dependency line is only used if you run lein repl
from within a clojure project. @ matthew-moss之上的另一个注释:只有在clojure项目中运行
lein repl
时才使用tools.nrepl依赖行。 if you just run lein repl
from your home directory, for example, you end up using the version of tools.nrepl that is compiled into leiningen. 例如,如果你只是从你的主目录运行
lein repl
,你最终会使用编译成leiningen的tools.nrepl版本。 No idea why. 不知道为什么。
Hope that saves somebody time. 希望节省一些时间。
lein has an upgrade command so in the simplest case lein有一个升级命令,所以在最简单的情况下
lein upgrade
In case you installed leiningen with a package manager you might need to do something like the below (example for OS X, linux distros have their own wonderful package managers): 如果您使用软件包管理器安装leiningen,您可能需要执行类似下面的操作(OS X的示例,Linux发行版有他们自己的精彩软件包管理器):
brew unlink leiningen
brew update
brew install leiningen
As an addition to the accepted answer: adding dependency on 0.2.7 in user profiles.clj worked for me some days ago but then suddenly I got back to the 0.2.6 warning. 作为已接受答案的补充:在用户profiles.clj中添加对0.2.7的依赖性几天前为我工作但突然之后我又回到0.2.6警告。 Asking "lein deps :tree" had this line in it:
问“lein deps:tree”有这条线:
[org.clojure/tools.nrepl "0.2.7" :scope "test" :exclusions [[org.clojure/clojure]]]
Which gave me a clue that probably the lein-test-refresh plugin (defined in the same profiles.clj) is causing some confusion here. 这给了我一个线索,可能是lein-test-refresh插件(在同一个profiles.clj中定义)引起了一些混乱。 Reading some more about profiles I learnt about the ^:replace hint.
阅读更多关于我了解^:replace提示的配置文件 。 This line in dependencies works now for me:
依赖关系中的这一行现在适用于我:
^:replace [org.clojure/tools.nrepl "0.2.7"]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.