lein ring server: "这不是一个任务"

9

我正在尝试构建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.

我也尝试在luminous 网站 上使用hello-world,但它也显示无法找到该任务或其他示例,即使我从他们的教程直接复制该行,lein仍然抱怨我使用了错误数量的参数。

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

也:检查一下你是否在项目目录下 - undefined
1个回答

10

我猜你在project.clj文件中缺少ringcompjure插件:

(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 中定义一个处理程序函数!请参见此处此处,以获得非常好的介绍。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接