tool.namespace reload not working

679 views
Skip to first unread message

JPatrick Davenport

unread,
Apr 10, 2015, 9:19:37 PM4/10/15
to clo...@googlegroups.com
Hello,
I'm trying to implement the Component ideology. When run something manually with component/start-system and stop, it works fine. The main method calls component/start-system works fine too. But sadly when I try to get the user reflow to work (I copied user namespace from the README on GitHub), my main namespace is not reloading.

:reloading (deusdatsolutions.views deusdatsolutions.dynamics deusdatsolutions.handler deusdatsolutions.system.route deusdatsolutions.data deusdatsolutions.data-impl deusdatsolutions.system.database deusdatsolutions.system.common deusdatsolutions.system.server deusdatsolutions.system.core deusdatsolutions.user deusdatsolutions.handler-test deusdatsolutions.dynamics-test deusdatsolutions.data-impl-test deusdatsolutions.core user)
:error-while-loading deusdatsolutions.user
#<CompilerException java.lang.Exception: namespace 'deusdatsolutions.system.core' not found, compiling:(deusdatsolutions/user.clj:1:1)>

deusdatsolutions.system.core is there. It's in the user namespace that starts everything off.
(ns deusdatsolutions.user
 
(:require [com.stuartsierra.component :as component]
           
[clojure.tools.namespace.repl :refer [refresh]]
           
[deusdatsolutions.system.core :as site-core]))

(def system nil)

(defn init []
 
(alter-var-root #'system
   
(constantly (site-core/create-system))))

(defn start []
 
(alter-var-root #'system site-core/start-server))

(defn stop []
 
(alter-var-root #'system
   
(fn [s] (when s (site-core/stop-server s)))))

(defn go []
 
(init)
 
(start))

(defn reset []
 
(stop)
 
(refresh :after 'deusdatsolutions.user/go))

This loads fine, runs the go fine, runs the stop fine too. (reset) gets that error.

One thing that might be causing a problem is that I'm using a profiles.clj for dev. Something looks off in lein because I have to include the tools dependency in dev profile.

Thanks,
JPD

Andy Fingerhut

unread,
Apr 10, 2015, 9:36:12 PM4/10/15
to clo...@googlegroups.com
This may not find any relevant problems, but if you try running the latest version of Eastwood on your project [1], it can detect the following kinds of issues that might be causing problems:

* mismatches between namespace names, and the file names they are stored in [2]
* :require or :use clauses in ns forms that all but the most recent versions of tools.namespace does not recognize as dependencies, throwing off its ability to correctly track dependencies between your namespaces [3]

I'd be curious to hear if it does find any such issues in your project, and if it does, whether correcting them helps tools.namespace work as you hope.

Andy



--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JPatrick Davenport

unread,
Apr 10, 2015, 9:42:22 PM4/10/15
to clo...@googlegroups.com
Some more diagnostic information: 1) merging the profles into the project.clj didn't seem to do much; 2) setting the :repl-options {:init-ns user} changed the message to can't load deusdatsolutions.handler; 3) the user ns is in an optional source location of env/dev/clj/user.clj. If I move the file to the main src directory, it doesn't matter.

JPatrick Davenport

unread,
Apr 10, 2015, 10:00:02 PM4/10/15
to clo...@googlegroups.com
Apparently this is due to me calling reset when nothing had changed. I did that just to see things cycle. So not really sure why it happens, but there it is.

Joachim De Beule

unread,
Apr 3, 2017, 4:34:03 AM4/3/17
to Clojure
Hi JPatrick. I'm having the same sort of problems. Quite annoying! Did you manage to fix this in the end?

Joachim De Beule

unread,
Apr 4, 2017, 3:24:07 AM4/4/17
to Clojure
Turns out my problems were due to AOT compiling. Doing `lein clean` before firing up the repl fixed things.

Op maandag 3 april 2017 10:34:03 UTC+2 schreef Joachim De Beule:
Reply all
Reply to author
Forward
0 new messages