lein ring server:“那不是任务”

时间:2014-12-04 06:23:47

标签: clojure leiningen compojure luminus

我正在尝试为compojure构建hello-world示例,但它无法启动响铃任务。

$ lein version
Leiningen 1.7.1 on Java 1.7.0_65 OpenJDK 64-Bit Server VM
$ lein new compojure test
Created new project in: /home/myaccount/test
Look over project.clj and start coding in compojure/core.clj
$ cd test/
$ lein ring server
That's not a task. Use "lein help" to list all tasks.

我也试过在发光site上使用hello-world,也说它无法找到那个任务或其他例子,lein抱怨我使用了错误的参数数量如果我从tutorial直接拉线。

$ lein new luminus guestbook +h2
Wrong number of arguments to new task. 
Expected ([project-name] [project-name project-dir])

1 个答案:

答案 0 :(得分:8)

我猜你错过了project.clj文件中的铃声和compojure 插件

(defproject compojure "1.0.0-SNAPSHOT"
   :description "FIXME: write description"
   :dependencies [[org.clojure/clojure "1.3.0"]]
   :plugins [[lein-ring "0.8.8"]
             [compojure "1.1.6"]]

   ;; once you have the above, you'll see that you need
   ;; to configure ring. This is the most simple example:
   :ring {:handler compojure.core/handler})

当然你必须在src/compojure/core.clj中定义一个处理函数!请参阅herehere for a very nice introduction