I'm trying get Clojure/Compojure/appengine-magic to work by following the example at https://github.com/gcv/appengine-magic
But when I run lein appengine-prepare
I get:
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.
Have I missed something?
lein new simple-example
edit 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
edit core.clj:
(ns simple-exampl开发者_如何学编程e.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
The documentation states that appengine-magic
should be added to the :dev-dependencies
. I was able to reproduce your problem by creating a project from scratch and trying to run appengine-prepare
when appengine-magic
was in :dependencies
.
So instead of:
(defproject simple-example "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.2.1"] [appengine-magic "0.4.1"]])
You should have:
(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"]])
This should hopefully fix your problem.
精彩评论