运行clojure-1.9.0.jar的异常:缺少clojure / spec / alpha__init.class和clojure / spec / alpha.clj [英] Exception running clojure-1.9.0.jar: missing clojure/spec/alpha__init.class and clojure/spec/alpha.clj

查看:112
本文介绍了运行clojure-1.9.0.jar的异常:缺少clojure / spec / alpha__init.class和clojure / spec / alpha.clj的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

莱宁根下载了 clojure-1.9.0.jar 作为依赖项。它位于〜/ .m2 / repository / org / clojure / clojure / 1.9.0



但是,如果(来自〜/ .m2 / repository / org / clojure / clojure 我运行 java -jar 1.9.0 / clojure-1.9.0.jar ,而不是预期的行为(REPL的初始化),我得到了一个例外: / p>

无法在类路径中找到clojure / spec / alpha__init.class或clojure / spec / alpha.clj。



对于其他Clojure版本(1.8.0、1.6.0、1.4.0),我得到了预期的REPL。



那么clojure-1.9.0.jar是怎么回事--或我的设置-还是我的理解?



注意:

如果我运行 lein repl 在包含具有Clojure 1.9.0依赖项的项目的目录中,我得到带有Clojure 1.9.0的REPL,但是如果我从任何其他目录启动Leiningen,我都会得到一个带有Clojure 1.8.0的REPL。在两种情况下,REPL版本均为 REPL-y 0.3.7,nREPL 0.2.12
运行 lein upgrade 导致消息 Leiningen已经更新。

解决方案

Clojure 1.9.0已模块化,其规范支持分为两个必须放在类路径中的独立JAR。



请参阅 https://clojure.org/news/2017/12/08/ clojure19



Alex Miller指出,新的 clj 工具会自动为您解决此问题。


Leiningen downloaded clojure-1.9.0.jar as a dependency. It's located at ~/.m2/repository/org/clojure/clojure/1.9.0. It works fine through a lein repl.

However, if (from ~/.m2/repository/org/clojure/clojure I run java -jar 1.9.0/clojure-1.9.0.jar, instead of the expected behaviour (initiation of a REPL) I get an exception:

Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath.

For other Clojure versions (1.8.0, 1.6.0, 1.4.0) I get a REPL as expected.

So what's wrong with clojure-1.9.0.jar - - or my setup - or my understanding?

Note:
If I run lein repl in a directory containing a project with a Clojure 1.9.0 dependency I get a REPL with Clojure 1.9.0, but if I start Leiningen from any other directory I get a REPL with Clojure 1.8.0. In both cases, REPL versions are REPL-y 0.3.7, nREPL 0.2.12. Running lein upgrade results in the message Leiningen is already up-to-date.

解决方案

Clojure 1.9.0 is modularized with spec support broken off into two separate JARs that must be on your classpath.

See https://clojure.org/news/2017/12/08/clojure19

And as Alex Miller points out, the new clj tool will take care of this for you automatically.

这篇关于运行clojure-1.9.0.jar的异常:缺少clojure / spec / alpha__init.class和clojure / spec / alpha.clj的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆