Setting a project property to a non literal string appears to not work in leiningen

对着背影说爱祢 提交于 2019-12-12 09:54:12

问题


Take a simple project file:

(defproject sample-clojure-cloudbees "1.0.0-SNAPSHOT" :description "Sample clojure application - clojure 1.3 !" :blah "hello")

When I read (get project :blah) I get "hello" string returned - as expected.

If I replace "hello"

:blah (slurp "some file...")

I get an error, Caused by: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.String

It seems to not be evaluating things how I expect, any ideas?


回答1:


defproject is a macro it won't evaluate (slurp...) unless you tell it to,

replacing,

:blah (slurp "some file...")

with,

:blah ~(slurp "some file...")

will give you the content of the file.



来源:https://stackoverflow.com/questions/7738628/setting-a-project-property-to-a-non-literal-string-appears-to-not-work-in-leinin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!