Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

clojure

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.

like image 466
John Avatar asked Mar 07 '23 14:03

John


1 Answers

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.

like image 197
Mike Fikes Avatar answered Mar 27 '23 23:03

Mike Fikes