Closed Gastove closed 9 years ago
I can't reproduce this problem with the project.clj
and profiles.clj
listed above. Can anyone else trigger it?
I tried on lein 2.5.0 and wasn't able to reproduce. I added the following dependencies and plugins in project.clj to get environ up and running:
:dependencies [[org.clojure/clojure "1.6.0"]
[environ "1.0.0"]]
:plugins [[lein-environ "1.0.0"]]
Sounds like this is fixed in 2.5.0 then.
I have the same problem. I too am on OS X.
Exception in thread "main" java.io.FileNotFoundException: Could not locate ring/mock/request__init.class or ring/mock/request.clj on classpath: , compiling:(deusdatsolutions/handler_test.clj:1:1)
I'm on lein 2.5.1.
(defproject deusdatsolutions "0.1.0"
:description "Company site, but in Clojure."
:url "http://www.deusdatsolutions.com"
:min-lein-version "2.0.0"
:source-paths ["src/clj"]
:main deusdatsolutions.handler
:dependencies [[org.clojure/clojure "1.6.0"]
[compojure "1.3.1"]
[ring/ring-defaults "0.1.2"]
[hiccup "1.0.5"]
[environ "1.0.0"]
[com.draines/postal "1.11.3"]
[http-kit "2.0.0"]
[org.clojure/tools.logging "0.3.1"]]
:plugins [[lein-ring "0.8.13"]
[lein-cljsbuild "1.0.3"]
[lein-pdo "0.1.1"]
[lein-environ "1.0.0"]]
:ring {:handler deusdatsolutions.handler/app}
:profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring-mock "0.2.0"]
[midje "1.6.3"]]
:env {:dev true,
:production false}}
:uberjar {:aot :all}})
Same problem for me on OS X.
Leiningen 2.5.1 on Java 1.8.0_25 Java HotSpot(TM) 64-Bit Server VM
The problem is only triggered occasionally and when I change (and save) a file while the running lein ring server
. After restarting the server it always works fine.
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate ring/mock/request__init.class or ring/mock/request.clj on classpath: , compiling:(smio_fb/test/handler.clj:1:1)
My project.clj
(defproject smio-fb "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0"]
[ring-server "0.4.0"]
[selmer "0.8.2"]
[com.taoensso/timbre "3.4.0"]
[com.taoensso/tower "3.0.2"]
[markdown-clj "0.9.65"]
[environ "1.0.0"]
[im.chit/cronj "1.4.3"]
[compojure "1.3.3"]
[ring/ring-defaults "0.1.4"]
[ring/ring-session-timeout "0.1.0"]
[ring-middleware-format "0.5.0"]
[noir-exception "0.2.5"]
[bouncer "0.3.2" :exclusions [clj-time]]
[prone "0.8.1"]
[org.clojure/tools.nrepl "0.2.10"]
[ragtime "0.3.8"]
[yesql "0.5.0-rc3" :exclusions [instaparse]] ; it's included in compojure
[org.postgresql/postgresql "9.4-1201-jdbc41"]
[org.clojure/data.json "0.2.6"]
[ring-cors "0.1.7"]]
:min-lein-version "2.0.0"
:uberjar-name "smio-fb.jar"
:jvm-opts ["-server"]
;;enable to start the nREPL server when the application launches
;:env {:repl-port 7001}
:main smio-fb.core
:plugins [[lein-ring "0.9.1"]
[lein-environ "1.0.0"]
[lein-ancient "0.6.5"]
[ragtime/ragtime.lein "0.3.8"]]
:ring {:handler smio-fb.handler/app
:port 3001 ;; avoid conflict with rails
:init smio-fb.handler/init
:destroy smio-fb.handler/destroy
:uberwar-name "smio-fb-rest.war"}
:ragtime
{:migrations ragtime.sql.files/migrations
:database
"jdbc:postgresql://localhost/smio_fb?user=db_user_name_here&password=db_user_password_here"}
:profiles
{:uberjar {:omit-source true
:env {:production true}
:aot :all}
:dev {:dependencies [[ring-mock "0.1.5"]
[ring/ring-devel "1.3.2"]
[pjstadig/humane-test-output "0.7.0"]
]
:source-paths ["env/dev/clj"]
:jvm-opts "-XX:-OmitStackTraceInFastThrow"
:repl-options {:init-ns smio-fb.repl}
:injections [(require 'pjstadig.humane-test-output)
(pjstadig.humane-test-output/activate!)]
:env {:dev true}}})
Let me know if you need any more information to help reproduce.
I'm in the same boat.
It happens every time I change a file, exactly once. I have a profiles.clj
in the project directory which defines the environment for the dev
profile. It doesn't show the error when I remove the dev
profile settings from profiles.clj
.
I have a profiles.clj in the project directory which defines the environment for the dev profile. It doesn't show the error when I remove the dev profile settings from profiles.clj.
When you define a :dev
profile in both project.clj
and profiles.clj
, they won't be merged: the one in project.clj
will be ignored, only the one in profiles.clj
will be taken into account. That's exactly why the error doesn't happen if you remove the dev
profile in profiles.clj
.
This is a very frequent issue when using environ: The README recommends to specify the dev env variables under a dev
profile in profiles.clj
but it doesn't explain it will overwrite any dev
profile in project.clj
. It's a known issue (weavejester/environ#15), there are workarounds explained in that issue, but the README is still misleading.
@nberger Great answer, thank you.
Something is causing lein to incorrectly merge my
:dev
profile from myproject.clj
. This is the squirreliest thing I've encountered yet. Observe:I have the following profile configs set:
Now, in a REPL session launched from my project root:
I get this result even if I explicitly activate the dev profile (i.e.
lein with-profile +dev repl
)If I move the dep declaration for
ring.mock
out in to the main project deps list, it loads perfectly. I have access to a second computer; on that computer, the:dev
profile of the project loads flawlessly -- ports get set, all dependencies are available. However, as nearly as I can tell, both machines are set up identically. Both machines have the same.lein/profiles.clj
. Both are running:I can't find any obvious environment variable differences. In fact, I am completely at a loss. I'm not even entirely sure what information to post here to help track this down -- please just let me know if there's any other info I can provide. For now, I'll mention I'm on OsX 10.9, and that the most current version of my
project.clj
is here.Thoughts?