technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.6k forks source link

'lein new' not working if 'lein-ancient' plugin in profile #1739

Closed xsc closed 10 years ago

xsc commented 10 years ago

Adding the current SNAPSHOT of lein-ancient to the :plugins vector of my ~/.lein/profiles.clj causes an ExceptionInInitializerError when running lein new. It seems to be missing the namespace clojure.data.priority-map which would hint at lein-ancient providing an incompatible version of org.clojure/data.priority-map - however, version 0.0.5 of that artifact contains the namespace in question.

I attached various related files/outputs below.


profiles.clj

{:user {:plugins [[lein-ancient "0.6.0-SNAPSHOT"]]}}

Shell

$ lein version
Leiningen 2.5.0 on Java 1.7.0_67 Java HotSpot(TM) 64-Bit Server VM
$ lein deps :plugin-tree
warn
 [lein-ancient "0.6.0-SNAPSHOT"]
   [ancient-clj "0.2.1"]
     [clj-aws-s3 "0.3.10" :exclusions [[joda-time] [org.clojure/clojure]]]
       [com.amazonaws/aws-java-sdk "1.7.5"]
         [com.fasterxml.jackson.core/jackson-annotations "2.1.1"]
         [com.fasterxml.jackson.core/jackson-core "2.1.1"]
         [com.fasterxml.jackson.core/jackson-databind "2.1.1"]
         [org.apache.httpcomponents/httpclient "4.2"]
           [org.apache.httpcomponents/httpcore "4.2"]
     [clj-time "0.8.0" :exclusions [[joda-time] [org.clojure/clojure]]]
     [commons-codec "1.9" :exclusions [[joda-time] [org.clojure/clojure]]]
     [commons-logging "1.2" :exclusions [[joda-time] [org.clojure/clojure]]]
     [http-kit "2.1.19" :exclusions [[joda-time] [org.clojure/clojure]]]
     [joda-time "2.5" :exclusions [[joda-time] [org.clojure/clojure]]]
     [org.clojure/core.cache "0.6.4" :exclusions [[joda-time] [org.clojure/clojure]]]
     [org.clojure/core.memoize "0.5.6" :exclusions [[joda-time] [org.clojure/clojure]]]
     [org.clojure/data.priority-map "0.0.5" :exclusions [[joda-time] [org.clojure/clojure]]]
     [org.clojure/data.xml "0.0.8" :exclusions [[joda-time] [org.clojure/clojure]]]
     [version-clj "0.1.0" :exclusions [[joda-time] [org.clojure/clojure]]]
   [commons-io "2.4"]
   [jansi-clj "0.1.0"]
     [org.fusesource.jansi/jansi "1.11"]
   [pandect "0.4.1"]
     [org.bouncycastle/bcprov-jdk15on "1.51" :exclusions [[org.clojure/clojure]]]
   [potemkin "0.3.11"]
     [clj-tuple "0.1.7"]
     [riddley "0.1.7"]
   [rewrite-clj "0.3.9"]
     [fast-zip "0.4.0"]
     [org.clojure/clojure "1.6.0"]
     [org.clojure/tools.reader "0.8.3"]
$ lein new tester
Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at clojure.lang.RT.loadClassForName(RT.java:2093)
        at clojure.lang.RT.load(RT.java:430)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:421)
        at stencil.core$loading__4958__auto__.invoke(core.clj:1)
        at stencil.core__init.load(Unknown Source)
        at stencil.core__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at clojure.lang.RT.loadClassForName(RT.java:2093)
        at clojure.lang.RT.load(RT.java:430)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:512)
        at leiningen.new.templates$loading__4958__auto__.invoke(templates.clj:11)
        at leiningen.new.templates__init.load(Unknown Source)
        at leiningen.new.templates__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at clojure.lang.RT.loadClassForName(RT.java:2093)
        at clojure.lang.RT.load(RT.java:430)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:512)
        at leiningen.new$loading__4958__auto__.invoke(new.clj:1)
        at leiningen.new__init.load(Unknown Source)
        at leiningen.new__init.<clinit>(Unknown Source)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:270)
        at clojure.lang.RT.loadClassForName(RT.java:2093)
        at clojure.lang.RT.load(RT.java:430)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at leiningen.core.utils$require_resolve.invoke(utils.clj:68)
        at leiningen.core.utils$require_resolve.invoke(utils.clj:71)
        at leiningen.core.main$lookup_task_var.invoke(main.clj:61)
        at leiningen.core.main$pass_through_help_QMARK_.invoke(main.clj:68)
        at leiningen.core.main$task_args.invoke(main.clj:71)
        at leiningen.core.main$resolve_and_apply.invoke(main.clj:308)
        at leiningen.core.main$_main$fn__6136.invoke(main.clj:377)
        at leiningen.core.main$_main.doInvoke(main.clj:366)
        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.invoke(core.clj:624)
        at clojure.main$main_opt.invoke(main.clj:315)
        at clojure.main$main.doInvoke(main.clj:420)
        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)
Caused by: java.io.FileNotFoundException: Could not locate clojure/data/priority_map__init.class or clojure/data/priority_map.clj on classpath: , compiling:(clojure/core/cache.clj:1:1)
        at clojure.lang.Compiler.load(Compiler.java:7142)
        at clojure.lang.RT.loadResourceScript(RT.java:370)
        at clojure.lang.RT.loadResourceScript(RT.java:361)
        at clojure.lang.RT.load(RT.java:440)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at stencil.loader$fn__11403.invoke(loader.clj:43)
        at stencil.loader__init.load(Unknown Source)
        at stencil.loader__init.<clinit>(Unknown Source)
        ... 101 more
Caused by: java.io.FileNotFoundException: Could not locate clojure/data/priority_map__init.class or clojure/data/priority_map.clj on classpath: 
        at clojure.lang.RT.load(RT.java:443)
        at clojure.lang.RT.load(RT.java:411)
        at clojure.core$load$fn__5066.invoke(core.clj:5641)
        at clojure.core$load.doInvoke(core.clj:5640)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invoke(core.clj:5446)
        at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
        at clojure.core$load_lib.doInvoke(core.clj:5485)
        at clojure.lang.RestFn.applyTo(RestFn.java:142)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$load_libs.doInvoke(core.clj:5524)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.core$apply.invoke(core.clj:626)
        at clojure.core$require.doInvoke(core.clj:5607)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core.cache$eval641$loading__4958__auto____642.invoke(cache.clj:9)
        at clojure.core.cache$eval641.invoke(cache.clj:9)
        at clojure.lang.Compiler.eval(Compiler.java:6703)
        at clojure.lang.Compiler.eval(Compiler.java:6692)
        at clojure.lang.Compiler.load(Compiler.java:7130)
        ... 121 more
technomancy commented 10 years ago

I think this is a dupe of #1563; root cause is bugs in Clojure loading code that has been AOT'd.

xsc commented 10 years ago

Fair enough. I could "solve" the problem by adding

:exclusions [org.clojure/core.cache]

to lein-ancient's project.clj but that seems like a bug waiting to happen. OTOH, making users install it using

[lein-ancient "..." :exclusions [org.clojure/core.cache]]

just moves the problem... Meh.

technomancy commented 10 years ago

Actually, looking further at the problem, this is a bit different. It appears the logic that Stencil uses to determine whether core.cache is available is wrong--it catches FileNotFoundException but it misses the ExceptionInInitializerError that has a FileNotFound as its .getCause.

technomancy commented 10 years ago

Here's a fix: https://github.com/davidsantiago/stencil/pull/26

xsc commented 10 years ago

Thank you for your efforts!

Do you have any hints on how I could verify that this solves the issue? I tried including [stencil "0.3.5"]/[stencil "0.3.5" :exclusions [org.clojure/core.cache]] in the profile's :plugins but no cigar.

And running Leiningen from master seems to fail:

$ bin/lein version
java.lang.IllegalArgumentException: No matching field found: getConnectionManager for class org.apache.maven.wagon.providers.http.HttpWagon
 at clojure.lang.Reflector.getInstanceField (Reflector.java:271)
    clojure.lang.Reflector.invokeNoArgInstanceMember (Reflector.java:315)
    leiningen.core.ssl/fn (ssl.clj:91)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:624)
    clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    leiningen.core.project$load_certificates.invoke (project.clj:763)
    leiningen.core.project$activate_middleware.invoke (project.clj:770)
    leiningen.core.project$init_project.invoke (project.clj:877)
    leiningen.core.project$read.invoke (project.clj:951)
    leiningen.core.project$read.invoke (project.clj:952)
    leiningen.core.main$_main$fn__1226.invoke (main.clj:381)
    leiningen.core.main$_main.doInvoke (main.clj:378)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invoke (core.clj:624)
    clojure.main$main_opt.invoke (main.clj:315)
    clojure.main$main.doInvoke (main.clj:420)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    clojure.lang.Var.invoke (Var.java:388)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)
technomancy commented 10 years ago

Unfortunately the Clojure bug that causes this is only triggered by AOT, so you'd have to fake out the release process. You can try this locally by running bin/release 2.5.1 and pressing Ctrl-c when it asks you to confirm there haven't been any timing regressions.