0
votes

I'm trying to figure out how to run lein ring server for a Clojure Ring and Compojure application in Eclipse Mars with Counterclockwise on Windows.

I've added the correct dependencies to my project.clj file. Running this command from a command line works without any trouble.

However, if I type it into the repl inside eclipse I get the error : "CompilerException java.lang.RuntimeException: Unable to resolve symbol: lein in this context"

Is there a way to run lein ring server from within Eclipse?

I'm very new to Clojure development and hoping I'm just missing something simple here.

1

1 Answers

2
votes

You can run lein commands like this http://doc.ccw-ide.org/documentation.html#lein-generic-launcher .


Trying to run lein commands in repl is wrong as leiningen is build tool, and works like any other console program.


If you want to start ring server from repl you can, to do that you need to switch to namespace where you start ring server and start it, by evaluating server start code in repl. It's described at ring wiki https://github.com/ring-clojure/ring/wiki/Getting-Started , in the pretty much like this

(run-jetty handler {:port 3000})

Also I suggest to take a look at https://github.com/plexus/chestnut (app template) so your start server from repl will look like this

(run-web-server)

assuming you have method like this

(defn run-web-server [& [port]]
  (let [port (Integer. (or port (env :port) 10555))]
    (println (format "Starting web server on port %d." port))
    (run-jetty http-handler {:port port :join? false})))