8

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

$ 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.

我还尝试在发光网站上使用 hello-world ,它还说它找不到该任务或其他示例,其中 lein 抱怨我使用了错误数量的参数,即使我直接从他们的教程

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

1 回答 1

9

我怀疑您缺少文件中的 ring 和 compjure插件project.clj

(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!请参阅此处此处以获得非常好的介绍

于 2015-02-04T21:18:26.303 回答