-
-
Notifications
You must be signed in to change notification settings - Fork 182
Repl reloading
Reloading modified source files using clojure.tools.namespace.repl/refresh
(eg. by following Stuart's workflow) may return surprising results at the beginning:
boot.user=> (require '[clojure.tools.namespace.repl :as repl])
nil
boot.user=> (repl/refresh)
:reloading ()
:ok
No files reloaded? Looks like they are not found by c.t.n.repl, or being more specific scanned directories are simply incorrect. As the doc says directories may be overwritten by set-refresh-dirs
:
boot.user=> (def dirs (get-env :directories))
boot.user=> (apply repl/set-refresh-dirs dirs)
Then you can reload namespaces, no problems.
Additionally, you can take a look at system, a library optimized for REPL reloading, built with Boot in mind.
The above method has an interesting side effect of refreshing the namespaces that are compiled for both Clojure and Clojurescript (e.g. cljc files) even if you're only using them through Clojurescript. For example, if you are using something like mount on the client side, the mount.core
namespace will get reloaded on the JVM - the code is in the same file! This is bad, as the namespace has state that you don't want to touch.
As a workaround you might want to set the refresh-dirs
exclusively to the sources that you actually need to reload:
(apply tns/set-refresh-dirs
(map #(.getPath (io/file (System/getProperty "user.dir") %)) all-paths))
where all-paths
is a set of sources/resources to refresh defined in your build.boot
.
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util