问题
I noticed that (use 'somemodule :reload)
doesn't reload the module if the .clj file was not modified.
However I have an usecase for forcing the reload of the module even if the file isn't changed. I created a haml macro for clojure which reads an external file and generates clojure code.
( http://www.coldcode.net/2010/10/haml-macro-for-clojure.html )
I would like thus to be able to reload the clojure module regardless of the file timestamp.
Does anybody know if it's possible? (I would like to avoid touching the file from outside of my editor)
EDIT: I use clojure 1.2, leiningen 1.3.1
回答1:
:reload
will force reloading of the module.
But it sounds as if you use AOT compilation and clojure resorts to the AOT compiled .class files instead of the source. If you don't need AOT compilation (read: gen-class
in 99% of the cases, no dynamic byte code gen on the host vm in the rest) don't use it. If you really need AOT compilation, I can only think of removing the .class files for the namespace.
来源:https://stackoverflow.com/questions/3902545/force-clojure-reload