marick/lein-midje

clojure/tools.namespace required ?

siscia opened this issue · 9 comments

I tried without and lein midje where complaining about the lack of tools.namespace, I add tools.namespace and it worked without any problem.

I believe that tools.namespace should be added to the dependencies...

xsc commented

@siscia It'd probably be a good thing to specify the version of lein-midje you're using and supply the exception/error you encountered. Just for @marick to have something to work with.

Right, I amm talkin about:
[midje "1.6.2"] and [lein-midje "3.1.3"]

This is where I reveal the Java/leiningen ecosystem has defeated me. tools.namespace isn't used by lein-midje (as far as I can tell). It's used by Midje. But Midje does include tools.namespace among its dependencies. Why doesn't that carry over?

I honestly don'y know...

I was very surprised too...

Don't know what to say... If you need me to make some test just let me know...

xsc commented

@siscia Can you paste the respective project.clj and the exception/stacktrace?

Here we go:

(defproject
  wit
  "0.1.0-SNAPSHOT"
  :dependencies
  [[org.clojure/clojure "1.5.1"]
   [org.clojure/core.async "0.1.242.0-44b1e3-alpha"]
   [org.clojure/core.memoize "0.5.6"]
   [lib-noir "0.7.9"]
   [ring-server "0.3.1"]
   [crypto-random "1.1.0"]
   [org.clojure/data.json "0.2.3"]
   ;; [clabango "0.5"]
   [stencil "0.3.3" :exclusions [slingshot]]
   [clj-http "0.7.8"]
   [http-kit "2.1.14"]
   [lamina "0.5.0"]
   [com.draines/postal "1.11.1"]
   [com.taoensso/timbre "2.7.1"]
   [com.postspectacular/rotor "0.1.0"]
   [com.taoensso/tower "2.0.1"]
   [clj-time "0.6.0"]
   [clj-aws-s3 "0.3.7"]
   [com.novemberain/pantomime "2.0.0"]
   [org.clojure/java.jdbc "0.2.3"]
   [com.h2database/h2 "1.3.174"]
   [korma "0.3.0-RC6"]
   [lobos "1.0.0-beta1"]
   [com.cemerick/friend "0.2.0" :exclusions [ring/ring-core]]
   [compojure "1.1.6" :exclusions [ring/ring-core]]
   [log4j
    "1.2.17"
    :exclusions
    [javax.mail/mail
     javax.jms/jms
     com.sun.jdmk/jmxtools
     com.sun.jmx/jmxri]]]
  :ring
  {:handler wit.handler/handler,
   :init wit.handler/init,
   :destroy wit.handler/destroy}
  :profiles
  {:production {:ring
                {:open-browser? false, :stacktraces? false, :auto-reload? false}},
   :dev {:dependencies [[ring-mock "0.1.5"]
                        [ring/ring-devel "1.2.1"]
                        [clj-ns-browser "1.3.1"]
                        [alembic "0.2.0"]
                        [midje "1.6.2"]
                        ;; [org.clojure/tools.namespace "0.2.4"]
                        ]
         :plugins [[lein-midje "3.1.3"]]}
   }
  :main wit.repl
  :url  "http://example.com/FIXME"
  :plugins
  [[lein-ring "0.8.10"]
   [lein-ancient "0.4.4"]
   [lein-annotations "0.1.0"]]
  :repl-options {:port 4555}
  :description
  "FIXME: write description"
  :min-lein-version "2.0.0")

And here is the error:

simo@simo:~/workinvoice$ lein midje
Retrieving org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.pom from central
Retrieving org/clojure/tools.namespace/0.2.4/tools.namespace-0.2.4.pom from central
Retrieving org/clojure/tools.namespace/0.1.3/tools.namespace-0.1.3.jar from central
Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/namespace/repl__init.class or clojure/tools/namespace/repl.clj on classpath: 
    at clojure.lang.RT.load(RT.java:443)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:457)
    at midje.data.project_state$eval7289.invoke(project_state.clj:14)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:2088)
    at midje.repl$eval801$loading__4910__auto____802.invoke(repl.clj:1)
    at midje.repl$eval801.invoke(repl.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.RT.loadResourceScript(RT.java:370)
    at clojure.lang.RT.loadResourceScript(RT.java:361)
    at clojure.lang.RT.load(RT.java:440)
    at clojure.lang.RT.load(RT.java:411)
    at clojure.core$load$fn__5018.invoke(core.clj:5530)
    at clojure.core$load.doInvoke(core.clj:5529)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.core$load_one.invoke(core.clj:5336)
    at clojure.core$load_lib$fn__4967.invoke(core.clj:5375)
    at clojure.core$load_lib.doInvoke(core.clj:5374)
    at clojure.lang.RestFn.applyTo(RestFn.java:142)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$load_libs.doInvoke(core.clj:5413)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invoke(core.clj:619)
    at clojure.core$require.doInvoke(core.clj:5496)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at user$eval797.invoke(form-init5200069199625287044.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6609)
    at clojure.lang.Compiler.eval(Compiler.java:6608)
    at clojure.lang.Compiler.load(Compiler.java:7064)
    at clojure.lang.Compiler.loadFile(Compiler.java:7020)
    at clojure.main$load_script.invoke(main.clj:294)
    at clojure.main$init_opt.invoke(main.clj:299)
    at clojure.main$initialize.invoke(main.clj:327)
    at clojure.main$null_opt.invoke(main.clj:362)
    at clojure.main$main.doInvoke(main.clj:440)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Subprocess failed

Without the comment in the project.clj it works without a problem...

xsc commented

If I run lein deps :tree on your project I get the following output:

[clj-ns-browser "1.3.1"] -> [org.clojure/tools.namespace "0.1.3"]
 overrides
[midje "1.6.2"] -> [org.clojure/tools.namespace "0.2.4"]

Consider using these exclusions:
[midje "1.6.2" :exclusions [org.clojure/tools.namespace]]

And indeed, version 0.1.3 does not contain the namespace clojure.tools.namespace.repl, causing the exception. If I use the following artifact coordinates, the tests run:

[clj-ns-browser "1.3.1" :exclusions [org.clojure/tools.namespace]]

I recommend using :pedantic? :abort in your project.clj (or at least :pedantic? :warn). It might take some time to figure out which exclusions to use but it'll be beneficial in the long run.

I think this can now be closed. Object if I'm wrong.

Now using :pedantic in Midje itself.