tailrecursion / boot

A Clojure build tool
Eclipse Public License 1.0
111 stars 18 forks source link

boot fails with datomic-free #28

Closed ulsa closed 10 years ago

ulsa commented 10 years ago

If I have datomic-free (any version, it seems) as a dependency, I get this output when I run boot:

$ boot development
org.apache.commons.codec.binary.Base32

If I remove the datomic dependency, like so:

  :dependencies '[[tailrecursion/boot.task   "2.2.1"]
                  [tailrecursion/hoplon      "5.10.8"]
                  [org.clojure/clojurescript "0.0-2234"]
                  [tailrecursion/boot.ring   "0.2.1"]
                  #_[com.datomic/datomic-free "0.9.4815.12"]
                  [datascript "0.1.6"]
                  [org.clojure/algo.generic "0.1.2"]
                  [lein-light-nrepl "0.0.18"]
                  [org.clojure/tools.nrepl "0.2.3"]]

then it works fine:

$ boot development
Compiling Hoplon dependencies...
Jetty server stored in atom here: #'tailrecursion.boot.task.ring/server...
nrepl running on 56592
Compiling Hoplon pages...
• src/hl/testing_hoplon_castra/index.cljs.hl
Compiling ClojureScript...
alandipert commented 10 years ago

Odd! I was not able to reproduce. The build.boot I tested with is below. Could you please post your full build.boot and platform?

#!/usr/bin/env boot

#tailrecursion.boot.core/version "2.5.0"

(set-env!
  :project      'someapp
  :version      "0.1.0-SNAPSHOT"
  :dependencies '[[tailrecursion/boot.task   "2.2.1"]
                  [tailrecursion/hoplon      "5.10.8"]
                  [org.clojure/clojurescript "0.0-2202"]
                  [tailrecursion/boot.ring   "0.2.1"]
                  [com.datomic/datomic-free  "0.9.4815.12"]
                  [datascript                "0.1.6"]
                  [org.clojure/algo.generic  "0.1.2"]
                  [lein-light-nrepl          "0.0.18"]
                  [org.clojure/tools.nrepl   "0.2.3"]]
  :out-path     "resources/public"
  :src-paths    #{"src"})

(add-sync! (get-env :out-path) #{"assets"})

(require '[tailrecursion.hoplon.boot :refer :all])

(deftask development
  []
  (comp (watch) (hoplon {:prerender false :pretty-print true})))
ulsa commented 10 years ago

Created new hoplon-castra project, then manually added changes according to Daniel Neal's video.

MacOSX 10.9.3.

$ lein version
Leiningen 2.4.1 on Java 1.8.0_20-ea Java HotSpot(TM) 64-Bit Server VM
#!/usr/bin/env boot

#tailrecursion.boot.core/version "2.5.0"

(set-env!
  :project      'testing-hoplon-castra
  :version      "0.1.0-SNAPSHOT"
  :dependencies '[[tailrecursion/boot.task   "2.2.1"]
                  [tailrecursion/hoplon      "5.10.8"]
                  [org.clojure/clojurescript "0.0-2234"]
                  [tailrecursion/boot.ring   "0.2.1"]
                  [com.datomic/datomic-free "0.9.4815.12"]
                  [datascript "0.1.6"]
                  [org.clojure/algo.generic "0.1.2"]
                  [lein-light-nrepl "0.0.18"]
                  [org.clojure/tools.nrepl "0.2.3"]]
  :out-path     "resources/public"
  :src-paths    #{"src/hl" "src/cljs" "src/clj"})

;; Static resources (css, images, etc.):
(add-sync! (get-env :out-path) #{"assets"})

(require '[tailrecursion.hoplon.boot :refer :all]
         '[tailrecursion.castra.task :as c]
         '[lighttable.nrepl.handler :as light]
         '[clojure.tools.nrepl.server :as nrepl])

(deftask repl-light
  "Launch nrepl in the project"
  []
  (let [nrepl-server (atom nil)]
    (fn [continue]
      (fn [event]
        (swap! nrepl-server
               #(or % (nrepl/start-server
                       :port 0
                       :handler (nrepl/default-handler #'light/lighttable-ops))))
        (println "nrepl running on" (:port @nrepl-server))
        (continue event)
        @(promise event)))))

(deftask development
  "Build testing-hoplon-castra for development."
  []
  (comp (repl-light) (watch) (hoplon {:prerender false}) (c/castra-dev-server 'testing-hoplon-castra.api)))

(deftask production
  "Build testing-hoplon-castra for production."
  []
  (hoplon {:optimizations :advanced}))
vefjun commented 10 years ago

I added datomic as a dependency.

I got the same error, org.apache.commons.codec.binary.Base32, when using [tailrecursion/hoplon "5.10.11"] but it runs ok with [tailrecursion/hoplon "5.10.7"]

alandipert commented 10 years ago

I transplanted the :dependencies into a project.clj and ran lein deps :tree to see what was going on.

I discovered that datomic-free was bringing in a version of commons-codec (the library org.apache.commons.codec.binary.Base32 is in) that conflicts with what castra depends on via crypto-random:

([com.datomic/datomic-free "0.9.4815.12"] -> [com.amazonaws/aws-java-sdk "1.6.6" :exclusions [javax.mail/mail org.apache.httpcomponents/httpclient commons-logging]] -> [commons-codec "1.3"])
( overrides)
([tailrecursion/hoplon "5.10.8"] -> [tailrecursion/castra "2.1.0"] -> [crypto-random "1.2.0"] -> [commons-codec "1.6"])

We have tentative plans to move boot to a system using multiple JVMs that could help circumvent these kind of Maven/classloader nightmares. In the meantime though, as with lein, we are subject to them.

One fix is to bring in Datomic like this:

[com.datomic/datomic-free "0.9.4815.12" :exclusions [commons-codec]]
ulsa commented 10 years ago

Work-around OK. Thanks.