我使用tools.namespace在REPL上提供名称空间的智能重新加载。但是,在调用refresh
或refresh-all
时,会引发错误。
user=> (require '[clojure.tools.namespace.repl :as tn])
user=> (tn/refresh)
:reloading (ep31.common ep31.routes ep31.config ep31.application user ep31.common-test ep31.example-test)
:error-while-loading user
java.lang.Exception: No namespace: ep31.config, compiling:(user.clj:1:1)
它似乎最终处于这种奇怪的状态,(require ep31.config)
在没有错误的情况下工作,但之后命名空间并没有实际定义。
答案 0 :(得分:6)
我有点想到这一点,这似乎是情况的组合
target/classes
之前的lein uberjar
还有AOT编译的类,而不是之前的target/classes
jar
位于类路径很长一段时间,如果您之前进行过uberjar
/ target/
版本修改,请删除target/classes
,事情应该重新开始。
我还无法解决的问题是为什么{{1}}在类路径上开始。我怀疑Leiningen正在添加它,但还没有找到它发生的地点或原因。
答案 1 :(得分:-1)
我很难学到这一点,:target-path
的文档说(https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L309-L313):
;; All generated files will be placed in :target-path. In order to avoid
;; cross-profile contamination (for instance, uberjar classes interfering
;; with development), it's recommended to include %s in in your custom
;; :target-path, which will splice in names of the currently active profiles.
:target-path "target/%s/"
我想必须存在:target-path "target/%s/"
不是默认值的遗留原因。