This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-30
Channels
- # beginners (23)
- # boot (3)
- # cider (5)
- # clara (12)
- # cljs-dev (15)
- # clojure (18)
- # clojure-spec (24)
- # clojure-uk (23)
- # clojurescript (24)
- # data-science (2)
- # datascript (1)
- # datomic (12)
- # fulcro (51)
- # jobs (1)
- # jobs-discuss (1)
- # leiningen (1)
- # nrepl (1)
- # off-topic (1)
- # onyx (2)
- # re-frame (6)
- # reagent (14)
- # rum (1)
- # shadow-cljs (12)
- # spacemacs (3)
- # specter (1)
- # tools-deps (37)
- # vim (2)
If I try lein ancient
after incorporating lein-tools-deps
in my project.clj
it always tells me that the artifacts are up-to-date. What do I need to do to get lein ancient
work with lein-tools-deps
? Thanks.
@dorab because with lein-tools-deps
you're storing your deps in deps.edn, I'd recommend you use a tool that targets deps.edn directly. So far I only know of https://github.com/Olical/depot, but it works great
how alpha is add-lib? It fails for me like:
eggshell.controller> (deps/add-lib 'spec-provider {:mvn/version "0.4.14"})
true
eggshell.controller> (require 'spec-provider.provider)
FileNotFoundException Could not locate spec_provider/provider__init.class or spec_provider/provider.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name. clojure.lang.RT.load (RT.java:463)
If I try to add-lib
again, it returns false
which means that it didn’t have to add it again
@stathissideris don't know why that's happening, buut, you need to be under a DynamicClassLoader for it to work.
I’m not even sure what that means 🙂
I’m in a REPL, is that ok?
@hiredman sounds like I have to wait for a bit longer before I integrate it into my app
@stathissideris it is possible to change the class loader of a repl, I believe it's in the recent history.
add-lib works by finding the highest dynamic class loader in the current classloader chain and altering its loader sources
Some repl contexts do not have a shared dcl above all repl invocations
So changing it would not necessarily have any effect, I think nrepl creates a new context on every evaluation
Using clj repl works for me but nrepl things I’ve tried do not
Just need a dcl shared by all evals
@alexmiller I’m trying to integrate add-lib to my Swing app (and yes, I do realize it’s 2018 😄 ), the REPL entered the discussion because I naively thought that calling add-lib
from the app would also make it available to the REPL I’m developing with
Are you using nrepl?
but having the new libs available in the repl is not essential to me
I may need to read up on classloaders, I call add-lib
from within a future, would that make a difference?
@alexmiller this is the classloader chain within the future:
(#object[sun.misc.Launcher$AppClassLoader 0x42a57993 "[email protected]"]
#object[sun.misc.Launcher$ExtClassLoader 0x4306c985 "[email protected]"])
Starting with (.getContextClassLoader (Thread/currentThread))
. So no DCL there, I guess that explains itYou can do a set @stathissideris
oh, setContextClassLoader
!
@stathissideris If it helps, I had to do something similar here https://github.com/mfikes/clojurescript/commit/d68c9397599366777d9b322ec586fdd398302f25#diff-2c521d7ba435fbef7d128f4295f86785R612
@mfikes thanks, that looks like it may work 🙂
@mfikes @dominicm some progress! it seems that setting the classloader as @mfikes demonstrated allows add-lib
to work, but the added lib is still not available to the part of the app that needs to use it, presumably because it doesn’t share the same DCL… but now at least I understand how it works and I may be able to fix it somehow
many thanks to all
@stathissideris Cool. IIRC, in the change linked above, I shoved that DCL in at the earliest possible moment.
(It is the very first bit of code executed in main
, and my hope was that any threads spawned afterward would inherit it.)
that should be the case