lein appengine-prepare失败

时间:2011-04-10 18:54:53

标签: google-app-engine clojure compojure appengine-magic

我正按照https://github.com/gcv/appengine-magic

上的示例尝试让Clojure / Compojure / appengine-magic工作

但是当我跑lein appengine-prepare时,我得到了:

Exception in thread "main" C:\Users\henrik\IdeaProjects\simple-example\lib\dev not found. (NO_SOURCE_FILE:0)
        at clojure.lang.Compiler.eval(Compiler.java:5440)
        at clojure.lang.Compiler.eval(Compiler.java:5391)
        at clojure.core$eval.invoke(core.clj:2382)
        at clojure.main$eval_opt.invoke(main.clj:235)
        at clojure.main$initialize.invoke(main.clj:254)
        at clojure.main$script_opt.invoke(main.clj:270)
        at clojure.main$main.doInvoke(main.clj:354)
        at clojure.lang.RestFn.invoke(RestFn.java:457)
        at clojure.lang.Var.invoke(Var.java:377)
        at clojure.lang.AFn.applyToHelper(AFn.java:172)
        at clojure.lang.Var.applyTo(Var.java:482)
        at clojure.main.main(main.java:37)
Caused by: C:\Users\henrik\IdeaProjects\simple-example\lib\dev not found.

我错过了什么吗?

lein new simple-example

编辑project.clj:

(defproject simple-example "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.2.1"] [appengine-magic "0.4.1"]])

lein deps

lein appengine-new

编辑core.clj:

(ns simple-example.core
  (:use compojure.core)
  (:require [appengine-magic.core :as ae]))

(defroutes simple-example-app-handler
  (GET "/" req
       {:status 200
        :headers {"Content-Type" "text/plain"}
        :body "Hello, world!"})
  (GET "/hello/:name" [name]
       {:status 200
        :headers {"Content-Type" "text/plain"}
        :body (format "Hello, %s!" name)})
  (ANY "*" _
       {:status 200
        :headers {"Content-Type" "text/plain"}
        :body "not found"}))

(ae/def-appengine-app simple-example-app #'simple-example-app-handler)

lein appengine-prepare

1 个答案:

答案 0 :(得分:3)

文档说明appengine-magic应添加到:dev-dependencies。我能够通过从头开始创建项目并在appengine-prepare appengine-magic时尝试运行:dependencies来重现您的问题。

所以而不是:

(defproject simple-example "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.2.1"] [appengine-magic "0.4.1"]])

你应该:

(defproject simple-example "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.2.1"]]
  :dev-dependencies [[appengine-magic "0.4.1"]])

这应该有望解决您的问题。