这里是Clojure菜鸟。我正在尝试将数据集成到一个compojure-api项目中。在jetty上有一个冲突,所以基于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"]]}})然而,我现在不能在repl中使用datomic (可能,当我在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
发布于 2019-02-12 07:51:29
我还没有使用您所拥有的确切组合,但它可能有助于克隆the Tupelo Datomic project。它是一个独立的项目,使用的数据自由,是完全自包含的。克隆存储库,您应该能够运行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框架。
https://stackoverflow.com/questions/54637514
复制相似问题