component

tianshu 2016-03-13T16:14:34.000004Z

I meet a problem when I try to uberjar with :aot :all:

java.lang.ClassNotFoundException: com.stuartsierra.component.Lifecycle

tianshu 2016-03-13T16:16:00.000005Z

The code is something like:

clojure
(ns tunnel.datomic
  (:require [datomic.api :as d]
            [com.stuartsierra.component :as component]
            [<http://clojure.java.io|clojure.java.io> :as io])
  (:import datomic.Util))

(defrecord DatomicDatabase [uri schema initial-data connection]
  component/Lifecycle
  (start [component]
    (d/create-database uri)
    (let [c (d/connect uri)]
      @(d/transact c schema)
      @(d/transact c initial-data)
      (assoc component :connection c)))
  (stop [component]
    (d/delete-database uri)
    (assoc component :connection nil)))

(defn new-database [db-uri]
  (DatomicDatabase.
    db-uri
    (first (Util/readAll (io/reader (io/resource "data/schema.edn"))))
    (first (Util/readAll (io/reader (io/resource "data/initial.edn"))))
    nil))