2
我正在通过本书工作Stuart Halloway和Aaron Bedra编程Clojure(第二版)。正如书中指示,我编辑和文件project.clj添加代码(这是由雷音新瓶儿创建),以便它读取:defproject编译器异常
(defproject pinger "0.0.1-SNAPSHOT"
:description "A website availability tester"
:dependencies [[org.clojure/clojure "1.3.0"]])
(ns pinger.core
(:import (java.net URL HttpURLConnection)))
(defn response-code [address]
(let [conn ^HttpURLConnection (.openConnection (URL. address))
code (.getResponseCode conn)]
(when (< code 400)
(-> conn .getInputStream .close))
code))
然后我尝试加载该文件,并获得以下错误:
user=> (load-file "src/pinger/project.clj")
CompilerException java.lang.RuntimeException: Unable to resolve symbol: defproject
in this context, compiling:(C:\Documents and Settings\vreinpa\My Documents\Books\ProgrammingClojure\code\src\pinger\project.clj:1)
我在做什么错在这里?
这是因为你使用装载的Linux/Unix语法文件?它看起来像你在Windows系统上。 – octopusgrabbus
此加载文件的语法可与其他.clj文件一起使用。所以,这不是问题。 –
这就像在maven'pom.xml'文件中添加java代码.. –