weavejester / lein-ring

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

Was something package name changed? #201

Closed t-matsudate closed 3 years ago

t-matsudate commented 5 years ago

I tried to run lein ring server-headless but I've gotten following exception messages:

Exception in thread "main" java.lang.AssertionError: Assert failed: (dep-spec? dep-spec)
        at leinjacker.deps$dep_name.invokeStatic(deps.clj:23)
        at leinjacker.deps$dep_name.invoke(deps.clj:23)
        at leinjacker.deps$has_dep_QMARK_$fn__793.invoke(deps.clj:41)
        at clojure.core$some.invokeStatic(core.clj:2592)
        at clojure.core$some.invoke(core.clj:2583)
        at leinjacker.deps$has_dep_QMARK_.invokeStatic(deps.clj:41)
        at leinjacker.deps$has_dep_QMARK_.invoke(deps.clj:30)
        at leinjacker.deps$add_if_missing.invokeStatic(deps.clj:50)
        at leinjacker.deps$add_if_missing.invoke(deps.clj:43)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$apply.invoke(core.clj:641)
        at leiningen.ring.util$update_project.invokeStatic(util.clj:65)
        at leiningen.ring.util$update_project.doInvoke(util.clj:61)
        at clojure.lang.RestFn.invoke(RestFn.java:442)
        at leiningen.ring.server$add_dep.invokeStatic(server.clj:30)
        at leiningen.ring.server$add_dep.invoke(server.clj:29)
        at leiningen.ring.server$add_server_dep.invokeStatic(server.clj:34)
        at leiningen.ring.server$add_server_dep.invoke(server.clj:32)
        at leiningen.ring.server$server_task.invokeStatic(server.clj:80)
        at leiningen.ring.server$server_task.invoke(server.clj:72)
        at leiningen.ring.server_headless$server_headless.invokeStatic(server_headless.clj:7)
        at leiningen.ring.server_headless$server_headless.invoke(server_headless.clj:4)
        at clojure.lang.AFn.applyToHelper(AFn.java:154)
        at clojure.lang.AFn.applyTo(AFn.java:144)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$apply.invoke(core.clj:641)
        at leiningen.ring$ring.invokeStatic(ring.clj:24)
        at leiningen.ring$ring.doInvoke(ring.clj:13)
        at clojure.lang.RestFn.invoke(RestFn.java:425)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$apply.invoke(core.clj:641)
        at leiningen.core.main$partial_task$fn__4687.doInvoke(main.clj:284)
        at clojure.lang.RestFn.applyTo(RestFn.java:139)
        at clojure.lang.AFunction$1.doInvoke(AFunction.java:29)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invokeStatic(core.clj:648)
        at clojure.core$apply.invoke(core.clj:641)
        at leiningen.core.main$apply_task.invokeStatic(main.clj:334)
        at leiningen.core.main$apply_task.invoke(main.clj:320)
        at leiningen.core.main$resolve_and_apply.invokeStatic(main.clj:340)
        at leiningen.core.main$resolve_and_apply.invoke(main.clj:336)
        at leiningen.core.main$_main$fn__4760.invoke(main.clj:449)
        at leiningen.core.main$_main.invokeStatic(main.clj:439)
        at leiningen.core.main$_main.doInvoke(main.clj:436)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at clojure.lang.Var.invoke(Var.java:383)
        at clojure.lang.AFn.applyToHelper(AFn.java:156)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.core$apply.invokeStatic(core.clj:646)
        at clojure.main$main_opt.invokeStatic(main.clj:314)
        at clojure.main$main_opt.invoke(main.clj:310)
        at clojure.main$main.invokeStatic(main.clj:421)
        at clojure.main$main.doInvoke(main.clj:384)
        at clojure.lang.RestFn.invoke(RestFn.java:457)
        at clojure.lang.Var.invoke(Var.java:394)
        at clojure.lang.AFn.applyToHelper(AFn.java:165)
        at clojure.lang.Var.applyTo(Var.java:700)
        at clojure.main.main(main.java:37)

I thought following code got something mistaking:

(defn add-server-dep [project]
  (-> project
      (add-dep ['ring ring-version])
      (add-dep '[ring-server/ring-server "0.5.0"])))

Was something package name changed lately?

weavejester commented 5 years ago

What do your dependencies look like?

t-matsudate commented 5 years ago

Hi, James. Thank you for replying to me.

My project dependencies are just following:

:exclusions [org.clojure/clojure
             org.clojure/clojurescript
             ring/ring-core]
:managed-dependencies [[org.clojure/clojure "1.9.0"]
                       [org.clojure/clojurescript "1.10.439"]
                       [ring/ring-core "1.7.1"]]
:dependencies [[org.clojure/clojure]
               [org.clojure/clojurescript]
               [org.clojure/java.jdbc "0.7.8"]
               [ring/ring-core]
               [ring/ring-defaults "0.3.2" :exclusions [javax.servlet/javax.servlet-api]]
               [hiccup "1.0.5"]
               [bidi "2.1.5"]
               [sablono "0.8.5"]
               [clj-http "3.9.1"]]
:profiles {:dev {:exclusions [ring]
                 :managed-dependencies [[ring "1.7.1"]]
                 :dependencies [[ring/ring-mock "0.3.2"]
                                [com.bhauman/figwheel-main "0.2.0"]
                                [org.apache.derby/derby "10.14.2.0"]
                                [ring :exclusions [ring/ring-core]]]
                 :plugins [[lein-codox "0.10.5"]
                           [lein-ring "0.12.4"]
                           [lein-auto "0.1.3"]]}}
weavejester commented 5 years ago

Ah, it might be a problem with leinjacker and your managed dependencies. My guess is that leinjacker doesn't support that, and as lein-ring relies on leinjacker to manage the dependencies, lein-ring doesn't support it either.

If you change the managed dependencies into normal dependencies, does lein-ring work?

t-matsudate commented 5 years ago

Yeah, lein ring server-headless just worked when managed-dependencies isn't written in project.clj. Thank you for giving its idea to me!

ejschoen commented 5 years ago

It looks like leinjacker 0.4.3 works with managed dependencies, so it's possible to include leinjacker 0.4.3 before lein-ring in the plugin dependencies.

:plugins [[leinjacker "0.4.3"]
          [lein-ring "0.12.5" :exclusions [leinjacker]]
          [lein-parent "0.3.5"]]
t-matsudate commented 5 years ago

@ejschoen Oh! Thank you for telling good thing to me! lein ring server-headless ran with :managed-dependencies when I tried it which you told!

I had not noticed plugins can also exclude their dependencies. XD (Thank you telling it too!)

antonmos commented 3 years ago

updating leinjacker does work. I created a PR to make this permanent.

antonmos commented 3 years ago

@weavejester could you please make a release with this fix? Thanks!

weavejester commented 3 years ago

@weavejester could you please make a release with this fix? Thanks!

Released 0.12.6. Sorry about the delay.

antonmos commented 3 years ago

No problem and thank you!