編輯:已解決 我的問題來自兩件事 - 我在defmacro某處出現語法錯誤。我刪除它,並寫了一個小功能,然後我可以訪問(只有在重新啓動repl後)。最大的第二個問題是,我不知道repl需要重新啓動才能識別我所做的任何更改。如果沒有下面給出的具體答案,將永遠不會得出這個結論=)。從lein repl找到命名空間
我一直在研究github上的基礎教程,它建議通過repl測試一些東西 - 我的問題是我無法找到我感興趣的命名空間/宏或函數。
user=> (require '(junkyard-client.html-templates))
nil
user=> (def t (junkyard-client-templates))
user=> CompilerException java.lang.RuntimeException: Unable to resolve symbol:
junkyard-client-templates in this context, compiling:
(C:\Users\Ben\AppData\Local\Temp\form-init3290053673397861360.clj:1:8)
我嘗試過其他語法的東西,比如(需要'junkyard-client.html-templates)。 這是在底座教程v2.0.10:https://github.com/pedestal/app-tutorial/wiki/Slicing-Templates
編輯:這就是我試圖去
(ns junkyard-client.html-templates
(:use [io.pedestal.app.templates :only [tfn dtfn tnodes]]))
(defmacro junkyard-client-templates
[]
{:junkyard-client-page (dtfn (tnodes "junkyard-client.html" "hello") #{:id})
:other-counter (dtfn (tnodes "tutorial-client.html" "other-counter") #{:id}
})
解決階段
命名空間仍然沒有解決? user =>(需要'[junkyard-client.html-templates:as模板]) user =>異常命名空間'junkyard-client.html-templates'not found clojure.core/load-lib(core.clj: 5380) 我一定在做一些奇怪的事情。我開始從根目錄(垃圾場客戶端)的repl,我可以成功(開始)沒有問題。謝謝你的回答,因爲它幫助我更清楚地看到事情應該如何工作。 – Catalyst
嘗試使用'project.clj'文件在目錄內運行'lein repl',以便獲取您的依賴關係和配置。 – Jared314
這就是我從哪裏運行,它掛鉤到項目並加載依賴關係 – Catalyst