I'm seeing an error on my ring server which I start with
lein with-profile dev ring server
java.io.FileNotFoundException: Could not locate midje/sweet__init.class or midje/sweet.clj on classpath: , compiling:(news/routes/headlines_test.clj:1:1)
...
Here's my project.clj:
(defproject news "0.1.0-SNAPSHOT"
:description "..."
:url "https://herokuapp.com"
:min-lein-version "2.0.0"
:ring {:handler news.core.handler/app
:init news.core.handler/init}
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.1"]
[ring/ring-defaults "0.1.3"]
[liberator "0.11.0"]
[cheshire "5.3.1"]
[org.clojure/java.jdbc "0.3.6"]
[postgresql/postgresql "9.3-1102.jdbc41"]
[yesql "0.5.0-rc1"]
[environ "1.0.0"]]
:plugins [[lein-ring "0.9.1"]
[lein-environ "1.0.0"]]
:profiles {:dev-default {:dependencies [[ring/ring-devel "1.3.1"]]}
:test-default {:dependencies [[midje "1.6.3"]
[javax.servlet/servlet-api "2.5"]
[ring-mock "0.1.5"]]
:plugins [[lein-midje "3.1.3"]]}
:production-default {:ring {:open-browser? false
:stacktraces? false
:auto-reload? false}}
;; Set these in ./profiles.clj
:dev-env-vars {}
:test-env-vars {}
:dev [:dev-default :dev-env-vars]
:test [:test-default :test-env-vars]
:production [:production-default] })
I guess my confusion is: Why am I getting an error about midje when I'm running the server in the dev environment?
You need to use lein with-profile +dev ring server
. If you use lein with-profile dev ring server
(note the absence of +
before dev), the dev profile will be used and replace the defaults.
There is more information available on invoking Leiningen with different profiles active here.
You also seem to have a test clojure file on your src path (news/routes/headlines_test.clj) which may be requiring midje. You either need to remove it from src and place it in another directory, or you need to include the test profile when invoking lein ring server, i.e. lein with-profile +dev,+test ring server
.