The run-jetty function does what the name suggests: it runs Jetty.
You're defining "server" with defonce, but then trying to use it as a
function. I'm also not sure why you have {:mode mode} in your code
snippet. What's that meant to do?
You want something more like:
(defn server [port]
(run-jetty #'app {:port port})
But you might want to look into Lein-Ring instead of starting the
server yourself via -main.
- James
On 20 August 2012 07:07, JR <
james.r...@gmail.com> wrote:
> Hi:
>
> I'm a newbie to ring development, and I'm trying to uberjar up what little I've got developed so far so I can put it out on a demo server. But when I run lein1 uberjar, the process involves compiling the code, and when it compiles, for some reason it seems to automatically invoke the server, so the uberjar never completes.... everything just locks up while my server sits there listening on port 8080, from which I have to Ctrl-C to kill.
>
> My code looks like this: (snippet)
>
> (defonce server (ring.adapter.jetty/run-jetty
> #'app {:host "127.0.0.1" :port 8080 :join? false}))
>
> (defn -main
> [& m]
> (let [mode (keyword (or (first m) :dev))
> port (Integer. (get (System/getenv) "PORT" "8080"))]
> (server port {:mode mode
> })))
>
> And the message I get on compilation is:
> Jamess-MacBook-Pro-Retina:choozy.git jr$ lein1 uberjar
> Copying 40 files to /Users/jr/opt/choozy.git/lib
> Compiling me.choozy.www.web.server
> 2012-08-19 23:06:42.543:INFO:oejs.Server:jetty-7.6.1.v20120215
> 2012-08-19 23:06:42.571:INFO:oejs.AbstractConnector:Started
SelectChann...@127.0.0.1:8080
>
> Any idea how to avoid this starting?
>
> Thanks in Advance!!