莱恩环服务器:“这不是一项任务”

我试图为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.

我也尝试在发光网站上使用hello-world,它也说它找不到这个任务或其他例子,哪里lein抱怨我使用了错误的参数数量,即使我直接从他们的教程。

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

我猜你缺少project.clj文件中的ring和compjure插件:

(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定义一个处理函数! 在这里或这里看到一个非常好的介绍。

链接地址: http://www.djcxy.com/p/56985.html

上一篇: lein ring server: "That's not a task"

下一篇: What's the relationship between Leiningen, Compojure, Luminus and Ring?