Skip to content

lein repl Problem Workaround

candera edited this page Feb 2, 2012 · 3 revisions

Some people, when running lein repl, encounter a failure with the following error message:

Exception in thread "main" java.lang.reflect.InvocationTargetException

This is due a problem with the way Leiningen deals with the classpath. This problem is due to be fixed soon (the version as of this writing is 1.6.2), but in the meantime, an easy workaround exists.

The Workaround

From a terminal:

  • Do a cd .. to move out of the ClojureScript One directory if you are currently in it. We need to run Leiningen to fix this problem, and leiningen is broken when run from within the ClojureScript One directory.
  • Run lein install org.clojure/clojure "1.2.1"
  • Wait for it to complete: this command can take several minutes to run. This is normal.

That's it: you should be able to cd back into the ClojureScript One directory and successfully run lein repl

Why This Works

The problem arises out of the fact that Leiningen itself requires version 1.2.1 of Clojure. But ClojureScript One requires version 1.3.0 of Clojure. The way that current versions of Leiningen work, the classpath is set up in such a way that when Leiningen runs, this version mismatch causes a problem unless version 1.2.1 of Clojure is available in the local Maven repository (your ~/.m2 directory). Running lein install org.clojure/clojure "1.2.1" installs version 1.2.1 of Clojure into the local Maven repository, preventing the problem from occurring.