Clojure Lein Classpath Woes

classpath, clojure, java, leiningen

Solution

Which version of Leiningen are you using? There are some breaking changes in the new 2 version, and one of them is that `:source-path "src/"` became `:source-paths ["src/"]`. A possible explanation is that you are trying to use this lein2 project.clj file with lein1.

Since we are currently in a transition period, you has to pay extra attention to which lein version you use yourself, and if following a tutorial, which version the tutorial assumes.

You can read more about the differences between the versions here: https://github.com/technomancy/leiningen/blob/master/NEWS.md

Problem

I have a Leiningen project.clj file as follows: ``` (defproject insane-noises "1.0.0-SNAPSHOT" :description "FIXME: write description" :dependencies [[org.clojure/clojure "1.3.0"] [overtone "0.6.0"]] :source-paths ["/Volumes/ramdisk"] :java-source-paths ["/Volumes/ramdisk"] :native-path "/Volumes/ramdisk") ``` Now, when I run ``` $ lein repl user=> (seq (.getURLs (java.lang.ClassLoader/getSystemClassLoader))) ``` the path /Volumes/ramdisk does NOT show up anywhere in my paths. What's going on? What is the right way to set class paths for Leiningen? (It also appears to be ignoring the CLASSPATH variable defined in my environment.) EDIT: responding to a comment ``` user=> (seq (.. Thread currentThread getContextClassLoader getURLs)) nil ``` EDIT: issues resolved. I was using ``` $ lein version Leiningen 1.7.1 on Java 1.6.0_29 Java HotSpot(TM) 64-Bit Server VM ``` However, I was apparently using the notation for Lein 2.0

Original source