Clojure的新手在这里。我想datomic集成到compojure-api
项目。有码头上的冲突,因此基于该docs,我project.clj
看起来是这样的,这使得它现在的工作,当我做lein ring server
(defproject dice-api "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.8.0"]
[metosin/compojure-api "1.1.11"]
[com.datomic/client-pro "0.8.28"
:exclusions [org.eclipse.jetty/jetty-client
org.eclipse.jetty/jetty-http
org.eclipse.jetty/jetty-util]]]
:ring {:handler dice-api.handler/app}
:uberjar-name "server.jar"
:profiles {:dev {:dependencies [[javax.servlet/javax.servlet-api "3.1.0"]]
:plugins [[lein-ring "0.12.0"]]}})
但是,我不能datomic在REPL现在(也许当我把它在我的Compojure-API端点,不会”工作)玩。
➜ dice-api lein repl
...
user=> (require '[datomic.client.api :as d])
nil
user=> (def local-cfg {:server-type :peer-server
#_=> :access-key "blahblahblah"
#_=> :secret "blahblahblah"
#_=> :endpoint "localhost:8998"})
#'user/local-cfg
user=> (defn client [cfg]
#_=> (d/client cfg))
#'user/client
user=> (def conn (d/connect (client local-cfg) {:db-name "hello"}))
CompilerException java.lang.ClassNotFoundException: org.eclipse.jetty.client.HttpClient, compiling:(cognitect/http_client.clj:1:1)
如何集成datomic
和compojure-api
?
我没有用,你有确切的组合,但它可能有助于克隆the Tupelo Datomic project。它是利用Datomic自由独立的项目,是完全独立的。克隆回购,你应该能够这样运行lein test
:
~/tupelo-datomic >
~/tupelo-datomic > lein clean
~/tupelo-datomic > lein test
WARNING: find already refers to: #'clojure.core/find in namespace: tupelo-datomic.core, being replaced by: #'tupelo-datomic.core/find
*clojure-version* => {:major 1, :minor 10, :incremental 0, :qualifier nil}
lein test tst.tupelo-datomic._bootstrap
-------------------------------
Clojure 1.10.0 Java 11
-------------------------------
lein test tst.tupelo-datomic.bond
lein test tst.tupelo-datomic.bond-query
lein test tst.tupelo-datomic.core
lein test tst.tupelo-datomic.find
lein test tst.tupelo-datomic.functionality
lein test tst.tupelo-datomic.quick-start
:using-local
Ran 17 tests containing 110 assertions.
0 failures, 0 errors.
~/tupelo-datomic >
因为它是完全独立的,你应该能够在任何Web框架,你想添加。