当我调用java -jar my-application.war时 使用lein ring uberware后 我收到了my-app.war中没有主要清单属性的回复 这是我的代码:
下面的命名空间提供了所需的:gen-class和-main函数:
(ns nutrif.core
(:require [ring.middleware.params]
[ring.middleware.resource :refer [wrap-resource]]
[ring.adapter.jetty]
[clojure.java.io :as io])
(:gen-class))
(defn handler [request]
{:status 200
:header {"Content-Type" "text/html"}
:body (io/input-stream (io/resource "public/index.html"))})
(def app
(wrap-resource handler "public"))
(defn -main
[& [port]]
(let [port (Integer. (or port
(System/getenv "PORT")
8080))]
(ring.adapter.jetty/run-jetty #'app {:port port
:join? false})))
这是我的project.clj,它指向具有-main函数的命名空间。我错过了什么?
(defproject nutrif "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[ring "1.3.0"]
[ring/ring-jetty-adapter "1.3.0"]]
:plugins [[lein-ring "0.8.11"]]
:dev-dependencies [[ring-serve "0.1.2"]
[javax.servlet/servlet-api "2.5"]]
:ring {:handler nutrif.core/app
:resource-paths [resources public]}
:main nutrif.core
:aot [nutrif.core])