Search code examples
clojurecider

How to handle interpendency between multiple files in cider?


I have create a project with two files core.clj and module.clj. On core.clj to be able to use function of module.clj I have declared :

(ns my-project.core
  (:require [my-project.module :as mod])) 

And on module.clj to be able to use function of core.clj I have declared :

(ns my-project.module
  (:require [my-project.core :as core])) 

Now, when I use 'cider-load-file on core.clj, I have an error due to function of module.clj, and if i start with module.clj, I have a error due to function of core.clj.

Is their a way to fix the issue, or is my code should be refactored ? It seems that I am able to build the jar with lein.


Solution

  • You must refactor to avoid dependency cycles. This is a feature of Clojure, not a requirement added by Cider or waived by Leiningen. "Building a jar" of Clojure stuff just means zipping it up, and thus is not a sign that the stuff is error-free.