2

我正在尝试按照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

编辑项目.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

4

1 回答 1

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"]])

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

于 2011-04-10T19:49:51.973 回答