我在这里感觉有点傻,但是无法编译Clojure Hello World。
目录结构:
hello-world/
clojure-1.1.0.jar
build/
classes/
src/
test/
hello.clj
hello.clj:
(ns test.hello
(:gen-class))
(defn -main [& args]
(println "Hello" (nth args 0)))
相互作用:
$ cd hello-world
[hello-world]$ java -cp ./clojure-1.1.0.jar:./build/classes:./src clojure.main
Clojure 1.1.0
user=> (require 'test.hello)
nil
user=> (test.hello/-main "there")
Hello there
nil
user=> (compile 'test.hello)
java.io.IOException: No such file or directory (hello.clj:2)
user=> *compile-path*
"classes"
user=> (doseq [p (.split (System/getProperty "java.class.path") ":")] (println p))
./clojure-1.1.0.jar
./build/classes
./src
nil
因此,我可以从REPL加载并调用文件,但无法编译。
根据clojure.org,编译需要
据我所知,我从一年前就发现了这篇文章,我的所作所为完全相同,但它不起作用。
我想念什么?
系统:OS X 10.6,Java 1.6.0,Clojure 1.1
我已经使用它简要地下载了外部项目的依赖项,但是到目前为止,还没有研究如何将其用作构建工具。感谢您提供的链接,我将对其进行检查。
不错的概述,感谢您的文章。大概大概我开始使用构建工具的时间:)
莱宁根对我没有帮助:$ lein测试找不到测试所需的project.clj
@mcandre阅读链接的文章,它解释了该过程。可以从github.com/alexott/lein-simple-project/下载(或git-cloned)一个示例项目。