I plan to describe the exact process on my blog soon. But here are some code snippets:
I’ve a core namespace with:
(ns com.example.core
(:require [com.example.system :as system]))
(defn -main [& _args]
(system/start :dev))
It just starts the system:
(ns com.example.system
(:require [integrant.core :as ig]))
;; read it using juxt/aero for example
(def config {})
(defn start [profile]
(ig/init config))
And that’s all.
I’ve a separate namespace user to run integrant-repl:
(ns user
(:require [clojure.tools.namespace.repl :refer [set-refresh-dirs]]
[clojure.java.classpath :refer [classpath-directories]]
[integrant.repl :as ig-repl :refer [clear go halt prep init reset reset-all]]
[com.example.system :as system]))
(let [target-dir? (fn [f]
;; match target, target/dev target/prod, etc.
(re-matches #".*target(/\w+)?" (str f)))]
(apply set-refresh-dirs
(remove target-dir? (classpath-directories))))
(ig-repl/set-prep! (constantly (system/config))
I don’t use rebel. I run the app with clojure -m com.example.core and the REPL with some aliases like clojure -A:dev:repl.
I hope it helps.
Also. If you need something with batteries included you can try out juxt/edge 