lein-ring icon indicating copy to clipboard operation
lein-ring copied to clipboard

tools.nrepl version added is very old

Open kumarshantanu opened this issue 7 years ago • 7 comments

The latest Leiningen version 2.7.1 adds [org.clojure/tools.nrepl "0.2.12"] whereas lein-ring adds [org.clojure/tools.nrepl "0.2.3"] to the project dependencies, which causes conflict when running lein ring server-headless with nREPL config enabled and :pedantic? :abort entry in project.clj.

Please either allow a way to specify the tools.nrepl version to be used with lein-ring, or use the latest version synced with latest Leiningen.

kumarshantanu avatar Sep 29 '17 20:09 kumarshantanu

I will probably upgrade this, but note that any dependency added by lein-ring can be superseded by depending on the thing explicitly

MichaelBlume avatar Sep 30 '17 03:09 MichaelBlume

I will probably upgrade this, but note that any dependency added by lein-ring can be superseded by depending on the thing explicitly

I tried adding an explicit tools.nrepl dependency (in :dev profile) but kept getting the same error due to :pedantic? :abort. Did you mean the same mechanism?

kumarshantanu avatar Sep 30 '17 04:09 kumarshantanu

Ah, I haven't used ':pedantic? :abort' so I'm not sure how that would work

On Fri, Sep 29, 2017 at 9:19 PM Shantanu Kumar [email protected] wrote:

I will probably upgrade this, but note that any dependency added by lein-ring can be superseded by depending on the thing explicitly

I tried adding an explicit tools.nrepl dependency (in :dev profile) but kept getting the same error due to :pedantic? :abort. Did you mean the same mechanism?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/weavejester/lein-ring/issues/193#issuecomment-333282149, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMv1R-B9ojpIAdKqEYQ8K6rpfV-sSMXks5sncE5gaJpZM4PpOWd .

MichaelBlume avatar Sep 30 '17 18:09 MichaelBlume

Jumping on the discussion since I have a similar issue with ring. I am wondering if lein ring server/server-headless should not remove any :pedantic config.

Within my project I use pedantic to ensure that dependencies converge at build time. Since running lein server is for local developments only it should be safe to turn off.

What do you think?

rborer avatar May 13 '19 10:05 rborer

I'm depending on [nrepl/nrepl "0.6.0"] but cannot override the nrepl dependency that lein-ring uses.

dpsutton avatar May 13 '20 14:05 dpsutton

I'm depending on [nrepl/nrepl "0.6.0"] but cannot override the nrepl dependency that lein-ring uses.

No, you won't be able to using this approach. If you have a look at the code, specifically:

https://github.com/weavejester/lein-ring/blob/master/src/leiningen/ring/server.clj

you will see that lein-ring explicitly references the older org.clojure/tools.nrepl, and there is no way to override this without updating the code. You could use the forked version referenced above, i.e.:

https://github.com/nxvipin/lein-ring

or wait for an update.

Outrovurt avatar Jul 27 '20 12:07 Outrovurt

... or, you can simply run a normal repl, e.g. via lein repl, start a jetty server manually, store its instance in an atom, and then you will have the version of nREPL which ships with leiningen (or the one you have specified explicitly in your dependencies.)

You can create the following as dev/user.clj:

(ns user
  (:require
   [ring.adapter.jetty :refer (run-jetty)]
   [your.server.app :refer (app-handler)]
   ))

(def server (atom nil))
(def server-opts
  {:port  3000
   :join? false})

(defn ring-start
  []
  
  (reset! server
          (run-jetty app-handler server-opts)))

(defn ring-stop
  []
  (.stop @server))

And don't forget to add "dev" to your :source-paths vector in your :dev profile so that the above file will be included in your source path. (As an added bonus, you can even add a ring-reset function, which may come in very useful when you make code changes.)

Outrovurt avatar Jul 27 '20 13:07 Outrovurt