将项目属性设置为非文字字符串在leiningen中不起作用 [英] Setting a project property to a non literal string appears to not work in leiningen

查看:127
本文介绍了将项目属性设置为非文字字符串在leiningen中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建一个简单的项目文件:



(defproject sample-clojure-cloudbees1.0.0-SNAPSHOT
:descriptionSample clojure application - clojure 1.3!
:blahhello)



当我读取(获得项目:blah)



如果我替换hello



:blah(slurpsome file ... p>

我得到一个错误,原因:java.lang.ClassCastException:clojure.lang.PersistentList不能转换为java.lang.String



似乎没有评估我的期望,任何想法?

解决方案

defproject是一个宏将不会评估(slurp ...),除非你告诉它,



替换

 :blah(slurpsome file ...)



<

 :blah〜(slurpsome file ...)
pre>

会为您提供文件的内容。


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?

解决方案

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.

这篇关于将项目属性设置为非文字字符串在leiningen中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆