weavejester / lein-ring

Ring plugin for Leiningen
Eclipse Public License 1.0
501 stars 100 forks source link

tools.nrepl version added is very old #193

Open kumarshantanu opened 7 years ago

kumarshantanu commented 7 years ago

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.

MichaelBlume commented 7 years ago

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

kumarshantanu commented 7 years ago

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?

MichaelBlume commented 7 years ago

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 notifications@github.com 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 .

rborer commented 5 years ago

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?

dpsutton commented 4 years ago

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

Outrovurt commented 4 years ago

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 commented 4 years ago

... 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.)