【发布时间】:2020-04-13 16:07:37
【问题描述】:
我在所有环路由之间共享一个命名空间,以便将每个路由保存在自己的文件中,所以我有一个文件 routes/core.clj,其中包含:
(ns test-proxy.routes.core)
;; Some utility functions
然后我像这样启动每个路由处理程序文件:
(in-ns 'test-proxy.routes.core)
;; rest of the code
当我启动服务器时,它运行良好。
但是当我更改任何文件并在浏览器中重新加载页面时,我收到以下错误:
Caused by: java.lang.Exception: Found lib name 'test-proxy.routes.core'
containing period with prefix 'quote'. lib names inside prefix lists
must not contain periods
如果我手动重新启动服务器 (lein ring server),一切都会再次按预期工作,但是一旦我在代码库中进行另一次更改,它就会失败并出现同样的错误。它看起来肯定与我使用命名空间的方式有关,但让我感到的是,当我重新启动服务器时它可以正常工作。
如果我像错误提示的那样将命名空间取消引用到(in-ns test-proxy.routes.core),则服务器甚至不会启动:
Syntax error (ClassNotFoundException) compiling at (diplomat/routes/docs.clj:1:1).
test-proxy.routes.core
【问题讨论】:
标签: clojure namespaces ring