Can't get generative.test working with pedestal.io

242 views Asked by At

Here is my recipe for failure:

lein new pedestal-app generative-app

I then modify project.clj to be the following:

(defproject generative-app "0.0.1-SNAPSHOT"
  :description "FIXME: write description"
  :repl-options {:init (use 'dev)}
  :dependencies [[org.clojure/test.generative "0.4.0"]
                 [org.clojure/clojure "1.5.1"]
                 [org.clojure/clojurescript "0.0-1586"]
                 [domina "1.0.1"]
                 [ch.qos.logback/logback-classic "1.0.7" :exclusions [org.slf4j/slf4j-api]]
                 [io.pedestal/pedestal.app "0.1.10"]
                 [io.pedestal/pedestal.app-tools "0.1.10"]]
  :profiles {:dev {:source-paths ["dev"]}}
  :min-lein-version "2.0.0"
  :source-paths ["app/src" "app/templates"]
  :resource-paths ["config"]
  :target-path "out/"
  :aliases {"dumbrepl" ["trampoline" "run" "-m" "clojure.main/main"]})

basically, I added test.generative and also made it execute (use 'dev) at startup.

I then enter the project and type lein repl, I get the error:

Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/tools/namespace/find__init.class or clojure/tools/namespace/find.clj on classpath: 
....
at io.pedestal.app_tools.server$eval3008$loading__4910__auto____3009.invoke(server.clj:12)
....
at dev$eval1071$loading__4910__auto____1072.invoke(dev.clj:1)

Clearly, when (use 'dev) is run, something goes haywire. I don't really know what.

If anyone would like to take a swing at it, I put the steps above into a project at [email protected]:samedhi/generative-app.git , so you can simply

> git clone [email protected]:samedhi/generative-app.git
> cd generative-app
> lein repl

Thanks for your help.

1

There are 1 answers

0
Daniel Neal On BEST ANSWER

The error is coming from clojure.tools.namespace.

Run lein deps :tree to show the dependency tree - in this case, the relevant bits are:

[io.pedestal/pedestal.app-tools "0.1.11-20130719.140954-2"]
   [org.clojure/tools.namespace "0.2.1"]

and

[org.clojure/test.generative "0.4.0"]
  [org.clojure/tools.namespace "0.1.1"]

You can see the conflict - test.generative 0.4.0 depends on an earlier version of tools.namespace.

Add an exclusion to the relevant line of your project.clj:

[org.clojure/test.generative "0.4.0" :exclusions [org.clojure/tools.namespace]]

This will make the project compile, and you can run (use dev) and (start) fine. However, there's a risk that after excluding tools.namespace 0.1.1, test.generative will no longer work (if it relies on functions that were in tools.namespace 0.1.1 and subsequently deprecated). Hopefully everything will be fine, but if not, you may need to wait for test.generative to catch up with the later version of tools.namespace.