Exception running clojure-1.9.0.jar: missing clojure/spec/alpha__init.class and clojure/spec/alpha.clj

前提是你 提交于 2020-04-13 07:23:29

问题


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.


回答1:


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.




回答2:


These classes have been split out, you can download the missing jar:

spec.alpha-#.###.jar

here.



来源:https://stackoverflow.com/questions/49476215/exception-running-clojure-1-9-0-jar-missing-clojure-spec-alpha-init-class-and

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!