On Wednesday, January 9, 2013 4:08:50 PM UTC-5, Phil Hagelberg wrote:
>
>
> John Gabriele writes:
>
> > What would I need to do in order to embed jetty so I can create an
> uberjar
> > (`lein uberjar`) and deploy it (I suppose via: `java -jar
> > my-webapp-0.1.0-standalone.jar &`)?
> >
> > What would need to be added to / changed in the project.clj?
> >
> > What exactly should the `-main` look like?
>
> All it takes is this in project.clj:
>
> [ring/ring-jetty-adapter "1.1.6"]
>
Ok. Added that to project.clj's :dependencies vector.
>
> and this in main.clj:
>
> (defn -main [& [port]]
> (let [port (Integer. (or port (System/getenv "PORT") 5000))]
> (jetty/run-jetty #'app {:port port :join? false}))))
>
>
Ok. That also meant I had to add the bare `jetty` to the ns's :require.
Was able to create the standalone jar (`lein uberjar`), but could not run
it ("Failed to load Main-Class"). Here's the project.clj:
~~~clojure
(defproject my-webapp "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.1.3"]
[ring/ring-jetty-adapter "1.1.6"]]
:plugins [[lein-ring "0.7.5"]]
:ring {:handler my-webapp.handler/app}
:profiles
{:dev {:dependencies [[ring-mock "0.1.3"]]}})
~~~
I'm guessing there's a `:main` missing in there. What should its value be?
---John
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en